1
0
mirror of https://github.com/gryf/wicd.git synced 2025-12-20 04:48:00 +01:00

Add support for using resolvconf instead of directly editing resolv.conf if possible.

This commit is contained in:
Dan O'Reilly
2009-03-09 00:07:39 -04:00
parent 842d281b28
commit b66bd696af
3 changed files with 67 additions and 44 deletions

View File

@@ -95,6 +95,10 @@ def Run(cmd, include_stderr=False, return_pipe=False, return_obj=False):
else:
err = None
fds = False
if return_obj:
std_in = PIPE
else:
std_in = None
# We need to make sure that the results of the command we run
# are in English, so we set up a temporary environment.
@@ -105,8 +109,8 @@ def Run(cmd, include_stderr=False, return_pipe=False, return_obj=False):
tmpenv["LANG"] = __LANG
try:
f = Popen(cmd, shell=False, stdout=PIPE, stderr=err, close_fds=fds,
cwd='/', env=tmpenv)
f = Popen(cmd, shell=False, stdout=PIPE, stdin=std_in, stderr=err,
close_fds=fds, cwd='/', env=tmpenv)
except OSError, e:
print "Running command %s failed: %s" % (str(cmd), str(e))
return ""