summaryrefslogtreecommitdiff
path: root/test/py/u_boot_spawn.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/py/u_boot_spawn.py')
-rw-r--r--test/py/u_boot_spawn.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/test/py/u_boot_spawn.py b/test/py/u_boot_spawn.py
index 7451455671..0f52d3e945 100644
--- a/test/py/u_boot_spawn.py
+++ b/test/py/u_boot_spawn.py
@@ -20,11 +20,13 @@ class Spawn(object):
sent to the process, and responses waited for.
"""
- def __init__(self, args):
+ def __init__(self, args, cwd=None):
"""Spawn (fork/exec) the sub-process.
Args:
- args: array of processs arguments. argv[0] is the command to execute.
+ args: array of processs arguments. argv[0] is the command to
+ execute.
+ cwd: the directory to run the process in, or None for no change.
Returns:
Nothing.
@@ -44,6 +46,8 @@ class Spawn(object):
# run under "go" (www.go.cd). Perhaps this happens under any
# background (non-interactive) system?
signal.signal(signal.SIGHUP, signal.SIG_DFL)
+ if cwd:
+ os.chdir(cwd)
os.execvp(args[0], args)
except:
print 'CHILD EXECEPTION:'