19 Commits

Author SHA1 Message Date
David Zuelke f8b002de47 Correctly handle Ctrl+C
When receiving a signal, a process must kill itself using the same signal
sys.exit()ing 0, 1, 130, whatever will not signal to the calling program that we terminated in response to the signal

Best example: `for f in a b c; do bob deploy $f; done`, hitting Ctrl+C should interrupt Bob and stop the bash loop, but does not with `sys.exit()`:

    # for x in php-7.3.13 php-7.3.13 php-7.3.13; do bob build $x; done
    Fetching dependencies... found 1:
      - libraries/libc-client-2007f

    Building formula php-7.3.13 in /tmp/bob-35s7cr5z:

    -----> Building php-7.3.13...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 18.7M  100 18.7M    0     0  7435k      0  0:00:02  0:00:02 --:--:-- 7434k
    ^Cool.
    Fetching dependencies... found 1:
      - libraries/libc-client-2007f

    Building formula php-7.3.13 in /tmp/bob-vmuko2ra:

    -----> Building php-7.3.13...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
     20 18.7M   20 3887k    0     0  7479k      0  0:00:02 --:--:--  0:00:02 7476k^Cool.
    Fetching dependencies... found 1:
      - libraries/libc-client-2007f

    Building formula php-7.3.13 in /tmp/bob-p2t8as81:

    -----> Building php-7.3.13...
      % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
      4 18.7M    4  943k    0     0  3599k      0  0:00:05 --:--:--  0:00:05 3588k^Cool.

We want instead to have the loop end upon the first Ctrl+C.

That's only possible if Bash knows that we exited in response to Ctrl+C (=SIGINT), then it'll also terminate the loop
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
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()
2020-01-15 02:01:38 +01:00
David Zuelke bda46256d9 print all informational output to stderr
all output from the formula build is on stdout already

this allows easy separating of the two into e.g. raw compile logs without bob's messages
2020-01-15 02:01:38 +01:00
Casey Faist 9b2890fb1c make CLI override name optional 2019-04-03 11:06:13 -07:00
Casey Faist da95c3b081 add ability to override the s3 archive file names
if given (via --name) the override name is passed to the formula as
the second argument
2019-03-25 18:05:31 -07:00
Ed Morley e838ff0027 flake8 import and whitespace fixes 2017-05-30 22:48:21 +01:00
Ed Morley bce1e3509d Make errors output to stderr
Using `print_function` is the cleanest option out of those on:
https://stackoverflow.com/questions/5574702/how-to-print-to-stderr-in-python
2017-05-25 01:51:07 +01:00
Ed Morley 7053c3e708 Remove unused dependencies and imports 2017-05-12 14:52:32 +01:00
David Zuelke fc2e325372 UPSTREAM_S3_BUCKET 2016-03-29 12:07:36 +02:00
David Zuelke 21570bb939 programs interrupted by SIGINT must exit with code 130 (128+INT) 2016-02-17 06:07:38 +01:00
David Zuelke 6b4891d719 use sys.exit instead of site.exit 2016-02-17 06:07:38 +01:00
kennethreitz e9392d6baf Update cli.py 2014-03-25 18:59:14 -04:00
Kenneth Reitz 3310ab8d93 refactor deps workflow 2014-03-13 14:56:02 -04:00
Kenneth Reitz a811dc9c44 o.o 2014-03-12 14:22:25 -04:00
Kenneth Reitz 2260f17693 polish 2014-03-12 13:46:32 -04:00
Kenneth Reitz 097da5b238 support for --overwrite flag 2014-03-12 13:14:50 -04:00
Kenneth Reitz d1cca7404e updates 2014-03-10 14:38:34 -04:00
Kenneth Reitz d1c7ae5091 cleanup 2014-03-10 14:33:27 -04:00
Kenneth Reitz 13c5cd9011 <3 2014-03-10 12:53:37 -04:00
Kenneth Reitz 8907e22e66 structure is flowing 2014-03-06 13:13:31 -05:00