summaryrefslogtreecommitdiffstats
path: root/py-bin
diff options
context:
space:
mode:
authorbanah <banah@2b6ed08e-c90c-0410-9317-ae88bde05ade>2007-03-16 15:11:18 +0000
committerbanah <banah@2b6ed08e-c90c-0410-9317-ae88bde05ade>2007-03-16 15:11:18 +0000
commit41ffb8bc3abb5cbc3f58b0b4154da717604528dc (patch)
treecbb8ce9c169f427c2fca39fb6d1d8d0244623f28 /py-bin
parente9c3e953ed7e946a58c54c06e0dea49999176f3c (diff)
ejabberdctl: use subprocess.Popen insted of subprocess.call
git-svn-id: https://rfd.cronopios.org/immerda/jabber@58 2b6ed08e-c90c-0410-9317-ae88bde05ade
Diffstat (limited to 'py-bin')
-rw-r--r--py-bin/ejabberdctl.py32
1 files changed, 16 insertions, 16 deletions
diff --git a/py-bin/ejabberdctl.py b/py-bin/ejabberdctl.py
index a1ef5ff..4391957 100644
--- a/py-bin/ejabberdctl.py
+++ b/py-bin/ejabberdctl.py
@@ -3,15 +3,6 @@
import subprocess, logging
import config
-#x remove
-#def __run(path, params, env):
-# params = [path] + params
-# try:
-# result = os.spawnve(os.P_WAIT, path, params, env)
-# return (result == 0)
-# except Exception:
-# return False
-
class EJabberdCtl:
def create_account(self, user, server, password):
if self.__ejabberdctl(["register", user, server, password]):
@@ -34,14 +25,23 @@ class EJabberdCtl:
def __ejabberdctl(self, params):
return self.__run([config.ejabberdctl_path] + params, config.ejabberdctl_environ)
+# def __run(self, path_and_params, environ={}):
+# try:
+# result = subprocess.call(path_and_params, env=environ)
+# if result != 0:
+# logging.error("Error invoking '%s': Result = %s." %
+# (str(path_and_params), str(result)))
+# return (result == 0)
+# except Exception, e:
+# logging.error("Error invoking '%s': %s." % (str(path_and_params), str(e)))
+# return False
+
def __run(self, path_and_params, environ={}):
- try:
- result = subprocess.call(path_and_params, env=environ)
- if result != 0:
- logging.error("Error invoking '%s': Result = %s." %
+ p = subprocess.Popen(path_and_params, stdin=subprocess.PIPE, env=environ)
+ #p.communicate(message)
+ result = p.wait()
+ if result != 0:
+ logging.error("Error invoking '%s': Result = %s." %
(str(path_and_params), str(result)))
- return (result == 0)
- except Exception, e:
- logging.error("Error invoking '%s': %s." % (str(path_and_params), str(e)))
return False