SIGINT emits outside
This python code runs good in bash python main.py in terminal, the exit code $? is 0.
from datetime import datetime
from time import sleep
try:
while True:
print(f"{datetime.now()}")
sleep(1)
except KeyboardInterrupt:
print(f'Keyboard interrupt')
However, I wrap it in justfile, the exit code $? is 130 always via just test. 130 = 128 + SIGINT(2), but the SIGINT should have been captured and ignored in the python code, so why does just emit it again in the end?
test:
python main.py
It can be reproduced in both 1.38.0 and the lastest 1.39.0.
Thanks for the report!
CTRL-C sends SIGINT to both just and the python subprocess. Just records receipt of SIGHUP, SIGINT, and SIGQUIT when it receives them, and if a child returns while it received those signals, just exits with the exit code set to 128 plus the signal number if the child returns success.
This is all to say that what you're observing is as expected, although, I can see the argument that just should continue if the child exits successfully. I'm kind of not sure why I made it behave as it does. In the case of a signal which was forwarded to the child, perhaps just should continue if the child ignores or otherwise handles the signal successfully.
I'm going to leave this issue open for discussion.