e.log.verbose("Sandbox directory: %s\n" % dir)
e.log.verbose("Sandbox command: %s\n" % cmd)
if dir == "" or not os.path.isdir(dir) or exe == "" or not os.path.isfile(exe):
- raise moe.MoeErr, "Sandbox set up incorrectly"
+ raise moe.MoeError, "Sandbox set up incorrectly"
def clean(e):
moe.util.remove_tree_contents(e.cfgs["BOXDIR"])
e.log.flush()
os.system("ls -Al %s | sed 's/^/\t/'" % e.cfgs["BOXDIR"])
-def run(e, opts,
+def run(e, opts, cmd):
+ c = e.cfgs["BOXCMD"] + " " + opts + " -- " + cmd
+ e.log.verbose("Sandbox: %s\n" % c)
+ e.log.flush()
+ st = os.system(c)
+ if os.WIFEXITED(st):
+ rc = os.WEXITSTATUS(st)
+ if rc > 1:
+ raise moe.MoeError, "Sandbox failed with rc=%d" % rc
+ return rc
+ else:
+ raise moe.MoeError, "Sandbox failed with exit status 0x%04x" % rc