def __exit__(self, exc_type, exc_value, traceback):
try:
if exc_type is None:
env = { k:v for (k,v) in os.environ.items() if k in self.whiteList }
env["BOB_LOCAL_ARTIFACT"] = self.name
env["BOB_REMOTE_ARTIFACT"] = self.remoteName
ret = subprocess.call(["/bin/bash", "-ec", self.uploadCmd],
stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
cwd="/tmp", env=env)
if ret != 0:
raise ArtifactUploadError("command return with status {}".format(ret))
finally:
os.unlink(self.name)
return False
评论列表
文章目录