mirror of
https://github.com/gryf/wicd.git
synced 2026-02-13 04:15:51 +01:00
Fix bytes/string issue for subprocess
This commit is contained in:
@@ -29,6 +29,7 @@ import re
|
|||||||
from pipes import quote
|
from pipes import quote
|
||||||
import socket
|
import socket
|
||||||
import string
|
import string
|
||||||
|
import subprocess
|
||||||
from subprocess import Popen, STDOUT, PIPE, call
|
from subprocess import Popen, STDOUT, PIPE, call
|
||||||
from subprocess import getoutput
|
from subprocess import getoutput
|
||||||
import sys
|
import sys
|
||||||
@@ -151,7 +152,8 @@ def Run(cmd, include_stderr=False, return_pipe=False,
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
f = Popen(cmd, shell=False, stdout=PIPE, stdin=std_in, stderr=err,
|
f = Popen(cmd, shell=False, stdout=PIPE, stdin=std_in, stderr=err,
|
||||||
close_fds=fds, cwd='/', env=tmpenv)
|
close_fds=fds, cwd='/', env=tmpenv,
|
||||||
|
encoding=sys.getdefaultencoding())
|
||||||
except OSError as e:
|
except OSError as e:
|
||||||
print(("Running command %s failed: %s" % (str(cmd), str(e))))
|
print(("Running command %s failed: %s" % (str(cmd), str(e))))
|
||||||
return ""
|
return ""
|
||||||
@@ -161,7 +163,7 @@ def Run(cmd, include_stderr=False, return_pipe=False,
|
|||||||
if return_pipe:
|
if return_pipe:
|
||||||
return f.stdout
|
return f.stdout
|
||||||
else:
|
else:
|
||||||
return f.communicate()[0].decode()
|
return f.communicate()[0]
|
||||||
|
|
||||||
|
|
||||||
def LaunchAndWait(cmd):
|
def LaunchAndWait(cmd):
|
||||||
|
|||||||
Reference in New Issue
Block a user