fdfcc77980
From "Tasmanian Devil" <tasm DOT devil AT googlemail DOT com> OK dcoppa@, sthen@, fgsch@
31 lines
956 B
Plaintext
31 lines
956 B
Plaintext
$OpenBSD: patch-py_lekatnet_remote_py,v 1.3 2010/10/20 11:29:46 dcoppa Exp $
|
|
--- py/lekatnet/remote.py.orig Wed Oct 20 13:08:11 2010
|
|
+++ py/lekatnet/remote.py Wed Oct 20 13:09:47 2010
|
|
@@ -45,7 +45,7 @@ import tpg
|
|
import time
|
|
import os
|
|
import config
|
|
-from popen2 import Popen3
|
|
+from subprocess import Popen, PIPE
|
|
|
|
|
|
class FormatString(tpg.Parser):
|
|
@@ -138,13 +138,10 @@ class RemoteCommand(threading.Thread):
|
|
#
|
|
def getstatusoutput(self, cmd):
|
|
"""Return (status, output) of executing cmd in a shell."""
|
|
- p = Popen3(cmd, capturestderr=True)
|
|
- p.tochild.write(self.stdin)
|
|
- p.tochild.close()
|
|
- err = p.childerr.read()
|
|
- p.childerr.close()
|
|
- text = p.fromchild.read()
|
|
- p.fromchild.close()
|
|
+ p = Popen(cmd, stderr=PIPE, stdin=PIPE, stdout=PIPE, close_fds=True, shell=True)
|
|
+ p.stdin.write(self.stdin)
|
|
+ err = p.stderr.read()
|
|
+ text = p.stdout.read()
|
|
sts = p.wait()
|
|
if sts is None: sts = 0
|
|
if text[-1:] == '\n': text = text[:-1]
|