prewikka/master: Replace obsoleted popen2 module by subprocess.Popen()

[email protected] Tue, 30 Jun 2009 10:22:02 +0200 (CEST)
Newsgroups gmane.comp.security.ids.prelude.cvs
Message-ID <[email protected]>
commit 25abbe1b4820313f62ced86ea8bb8f6e6ba85c22
Author: Yoann Vandoorselaere <[email protected]>
Date:   Tue Jun 30 10:21:38 2009 +0200

    Replace obsoleted popen2 module by subprocess.Popen()


========================================

 prewikka/views/commands.py |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

========================================

diff --git a/prewikka/views/commands.py b/prewikka/views/commands.py
index 17259d4..c8e2b09 100644
--- a/prewikka/views/commands.py
+++ b/prewikka/views/commands.py
@@ -18,8 +18,7 @@
 # the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
 
 
-import os, popen2
-
+import os, subprocess
 from prewikka import view, User, utils
 
 class Error(Exception):
@@ -49,10 +48,8 @@ class Command(view.View):
 
         command = command.replace("$host", self.parameters["host"]).split(" ")
 
-        pipe = popen2.Popen4(command)
-        pipe.wait()
+        output = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True).communicate()[0]
 
-        output = pipe.fromchild.read()
         output = utils.escape_html_string(output).replace(" ", "&nbsp;").replace("\n", "<br/>")
         self.dataset["command_output"] = output
 
_______________________________________________
Prelude-cvslog site list
[email protected]
http://lists.prelude-ids.org/mailman/listinfo/prelude-cvslog