Add --batch option as an alternative to STDIN#1723
Conversation
|
No correctness or security regressions stood out in the PR diff. Residual testing gaps (worth adding before merge):
I couldn’t run tests locally because |
No security-specific issues stood out in this diff. Assumption: I could not run pytest here ( |
factoring out a statements_from_filehandle() function which can also be used to improve the functionality of the "source" command. The initial behavior when both STDIN is not-a-tty and --batch is in effect is to warn, and use --batch. Similarly, the priority of the --execute option was clarified with warnings. These may be revisited: we could consider different behavior, as well as exiting with an error in case of warning. Motivation: display of a prompt_toolkit progress bar during batch execution. If the input is from STDIN, we can't know how many statements are the goal, at least without creating a tempfile. As mentioned above, this also lays the basis to improve the "source" command, which reads the entire file into memory.
0cdcb15 to
d239179
Compare
Description
Add
--batchoption as an alternative to STDIN, factoring out astatements_from_filehandle()function which can also be used to improve the functionality of thesourcecommand.The initial behavior when both STDIN is not-a-tty and
--batchis in effect is to warn, and use--batch. Similarly, the priority of the--executeoption was clarified with warnings. These may be revisited: we could consider different behavior, as well as exiting with an error in case of warning.Motivation: display of a prompt_toolkit progress bar during batch execution. If the input is from STDIN, we can't know how many statements are the goal, at least without creating a tempfile. As mentioned above, this also lays the basis to improve the
sourcecommand, which reads the entire file into memory.Checklist
changelog.mdfile.AUTHORSfile (or it's already there).