daemon: Improve launching xterm from a sudo environment.
This commit is contained in:
parent
94ad16e256
commit
ad60004fad
1 changed files with 7 additions and 3 deletions
|
@ -115,9 +115,13 @@ class VnodeClient(object):
|
||||||
return tmp
|
return tmp
|
||||||
|
|
||||||
def term(self, sh = "/bin/sh"):
|
def term(self, sh = "/bin/sh"):
|
||||||
return os.spawnlp(os.P_NOWAIT, "xterm", "xterm", "-ut",
|
cmd = ("xterm", "-ut", "-title", self.name, "-e",
|
||||||
"-title", self.name, "-e",
|
|
||||||
VCMD, "-c", self.ctrlchnlname, "--", sh)
|
VCMD, "-c", self.ctrlchnlname, "--", sh)
|
||||||
|
if "SUDO_USER" in os.environ:
|
||||||
|
cmd = ("su", "-s", "/bin/sh", "-c",
|
||||||
|
"exec " + " ".join(map(lambda x: "'%s'" % x, cmd)),
|
||||||
|
os.environ["SUDO_USER"])
|
||||||
|
return os.spawnvp(os.P_NOWAIT, cmd[0], cmd)
|
||||||
|
|
||||||
def termcmdstring(self, sh = "/bin/sh"):
|
def termcmdstring(self, sh = "/bin/sh"):
|
||||||
return "%s -c %s -- %s" % (VCMD, self.ctrlchnlname, sh)
|
return "%s -c %s -- %s" % (VCMD, self.ctrlchnlname, sh)
|
||||||
|
|
Loading…
Reference in a new issue