cli: hide traceback on interrupt, use os.execvp on supported systems #9864
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #9460.
EDIT: This patch has been updated to use
os.execvpon non-Windows systems. The discussion below is only applicable on Windows due to lack of POSIXexec*()functions.This fix treats
python -m lakefs ...as a convenient entry point, primarily intended for interactive use and limited workflows. So, this patch has two issues which I think is acceptable for that scenario:ttydriver delivers SIGINT to all foreground processes. As a result, pressing Ctrl + C already sends SIGINT to both the Python interpreter and the lakefs binary. However,subprocess.run()waits for a short period, 0.25 seconds by default, before forcefully terminating the child process withSIGKILL. So, this may not allow thelakefsbinary to exit gracefully.SIGKILLwhen the Python interpreter receives aSIGINT(after waiting for 0.25 second). The recommended way is to interrupt the binary rather than thelakefsmodule itself. So I think this is only a minor inconvenience.Alternatively, we could
SIG_IGNthe interrupt, but wanted to propose something simpler.Let me know if my understanding is incorrect.
I initially created #9805 from my fork, which is already approved.
Closes #9805