Fix error in usage of mkstemp function output

This commit is contained in:
Ethan Paul 2024-02-28 11:30:49 -05:00
parent c9c34353fc
commit 2cc57c32b7
Signed by: enpaul
GPG Key ID: 9B6D99E4CFA31867
2 changed files with 7 additions and 6 deletions

View File

@ -1,7 +1,8 @@
import sys
import os
import json
import tempfile
CONSTRUCTED_CONFIG_FILE = "/tmp/runner-config.json"
def main() -> str:
@ -20,12 +21,10 @@ def main() -> str:
print(f"Missing required configuration value {err}", file=sys.stderr)
sys.exit(1)
path = tempfile.mkstemp(prefix="semaphore-runner-")
with open(path, "w") as outfile:
with open(CONSTRUCTED_CONFIG_FILE, "w") as outfile:
json.dump(config, outfile, indent=4)
return path
sys.exit(0)
if __name__ == "__main__":

View File

@ -2,4 +2,6 @@
set -e
semaphore runner --config="$(python /configure.py)"
python /configure.py
semaphore runner --config=/tmp/runner-config.json