mirror of
https://gitdl.cn/https://github.com/chakralinux/core.git
synced 2025-02-12 02:24:40 +08:00
33 lines
1.4 KiB
Diff
33 lines
1.4 KiB
Diff
diff -ru src.p4/pexpect.py src.new/pexpect.py
|
|
--- src.p4/pexpect.py 2009-01-23 11:01:57.000000000 +0100
|
|
+++ src.new/pexpect.py 2012-01-12 13:38:06.000000000 +0100
|
|
@@ -209,7 +209,7 @@
|
|
Use this class to start and control child applications.
|
|
"""
|
|
|
|
- def __init__(self, command, args=[], timeout=30, maxread=2000, searchwindowsize=None, logfile=None):
|
|
+ def __init__(self, command, args=[], timeout=30, maxread=2000, searchwindowsize=None, logfile=None, env=None):
|
|
"""This is the constructor. The command parameter may be a string
|
|
that includes a command and any arguments to the command. For example:
|
|
p = pexpect.spawn ('/usr/bin/ftp')
|
|
@@ -302,6 +302,7 @@
|
|
self.child_fd = -1 # initially closed
|
|
self.timeout = timeout
|
|
self.delimiter = EOF
|
|
+ self.env = env
|
|
self.logfile = logfile
|
|
self.maxread = maxread # Max bytes to read at one time into buffer.
|
|
self.buffer = '' # This is the read buffer. See maxread.
|
|
@@ -421,7 +422,10 @@
|
|
# (specifically, Tomcat).
|
|
signal.signal(signal.SIGHUP, signal.SIG_IGN)
|
|
|
|
- os.execv(self.command, self.args)
|
|
+ if self.env is None:
|
|
+ os.execv(self.command, self.args)
|
|
+ else:
|
|
+ os.execve(self.command, self.args, self.env)
|
|
|
|
# Parent
|
|
self.terminated = 0
|