From 43880152b12f257e7b1df225d355e7207a49dcc8 Mon Sep 17 00:00:00 2001 From: Peter Amstutz Date: Wed, 13 Aug 2014 14:25:44 -0400 Subject: [PATCH] 3505: Adjust order of initialization to reflect potential side effects (e.g. file creation) on using functions such as $(glob) in the command. --- crunch_scripts/run-command | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crunch_scripts/run-command b/crunch_scripts/run-command index 7599f5c1bf..c85e74a6e4 100755 --- a/crunch_scripts/run-command +++ b/crunch_scripts/run-command @@ -145,19 +145,19 @@ try: else: taskp = jobp - cmd = expand_list(taskp, taskp["command"]) - if "task.vwd" in taskp: # Populate output directory with symlinks to files in collection vwd.checkout(subst.do_substitution(taskp, taskp["task.vwd"]), outdir) + if "task.cwd" in taskp: + os.chdir(subst.do_substitution(taskp, taskp["task.cwd"])) + + cmd = expand_list(taskp, taskp["command"]) + if "save.stdout" in taskp: stdoutname = subst.do_substitution(taskp, taskp["save.stdout"]) stdoutfile = open(stdoutname, "wb") - if "task.cwd" in taskp: - os.chdir(subst.do_substitution(taskp, taskp["task.cwd"])) - logging.info("{}{}".format(' '.join(cmd), (" > " + stdoutname) if stdoutname != None else "")) except Exception as e: -- 2.30.2