summaryrefslogtreecommitdiff
path: root/libre/sagemath/pexpect-env.patch
blob: 99cf44885b9cf84d351917f09b85629197bd7bd0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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