[RARSLAVE] Fix directory switching 2
authorIra W. Snyder <devel@irasnyder.com>
Tue, 26 Dec 2006 19:54:13 +0000 (11:54 -0800)
committerIra W. Snyder <devel@irasnyder.com>
Wed, 27 Dec 2006 04:25:26 +0000 (20:25 -0800)
Important bugfix. This resets the directory we are in after running the
command given to run_command(). This is the expected behavior, but was
overlooked.

None of the current code relies on this behavior, but it's good to act as
expected, anyway.

Signed-off-by: Ira W. Snyder <devel@irasnyder.com>
rarslave.py

index 657fa72..5be2b2f 100644 (file)
@@ -170,7 +170,9 @@ def run_command (cmd, indir=None):
                assert os.path.isdir (indir) # MUST be a directory!
                os.chdir (indir)
 
-       return os.system (cmd)
+       ret = os.system (cmd)
+       os.chdir (pwd)
+       return ret
 
 def full_abspath (p):
        return os.path.abspath (os.path.expanduser (p))