Skip to content

Instantly share code, notes, and snippets.

@pdcastro
Created October 4, 2021 22:45
Show Gist options
  • Save pdcastro/6cb935b152ad18e6f459cf8723b8c315 to your computer and use it in GitHub Desktop.
Save pdcastro/6cb935b152ad18e6f459cf8723b8c315 to your computer and use it in GitHub Desktop.
Extract 'REMOTE_EXIT_CODE=' from stdin and pass the rest through
#!/usr/bin/env python3
import fileinput, sys
exitCode = 0
for line in fileinput.input():
if line.startswith('REMOTE_EXIT_CODE='):
exitCode = int(line.split(sep='=', maxsplit=1)[1])
else:
print(line, end='')
sys.exit(exitCode)
@pdcastro
Copy link
Author

pdcastro commented Oct 4, 2021

Usage and context provided in this comment: balena-io/balena-cli#1535 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment