You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on May 23, 2024. It is now read-only.
# when receiving a signal, a process must kill itself using the same signal
68
+
# sys.exit()ing 0, 1, 130, whatever will not signal to the calling program that we terminated in response to the signal
69
+
# best example: `for f in a b c; do bob deploy $f; done`, hitting Ctrl+C should interrupt Bob and stop the bash loop
70
+
# that's only possible if Bash knows that we exited in response to Ctrl+C (=SIGINT), then it'll also terminate the loop
71
+
# bash will report the exit status as 128+$signal, so 130 for SIGINT, but sys.exit(130) does not to the same thing - the value of 130 is simply bash's representation
72
+
# killing ourselves with the signal number that we are aborting in response to does all this correctly, and bash will see the right WIFSIGNALED() status of our program, not WIFEXITED()
73
+
74
+
# and finally, before we send ourselves the right signal, we must first restore the handler for it to the default
p=Popen(args, cwd=cwd_path, shell=False, stderr=sys.stdout.fileno()) # we have to pass sys.stdout.fileno(), because subprocess.STDOUT will not do what we want on older versions: https://bugs.python.org/issue22274
144
139
145
-
pipe(p.stdout, sys.stdout, indent=True)
146
140
p.wait()
147
141
148
-
ifp.returncode!=0:
149
-
print_stderr('Formula exited with return code {}.'.format(p.returncode))
142
+
ifp.returncode>0:
143
+
print_stderr('Formula exited with return code {}.'.format(p.returncode), title='ERROR')
0 commit comments