-
-
Notifications
You must be signed in to change notification settings - Fork 31.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed #29501 -- Allowed dbshell to pass options to underlying tool. #12508
Conversation
d83da58
to
da8ccfc
Compare
Requested your review @claudep because you've reviewed a few dbshell PR's in the past :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, added some comments.
b89a213
to
2ec6ffc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Couple of comments.
Aside: it seems Scrub that: it turns out not using sqlite3
has no way to run a command and exit: --cmd
pops into the shell after running the supplied command. (That's not a problem with this PR.)--cmd
at all works as expected. Doh.
I think this is ready for merge? |
@adamchainz I will take a look in this week 👀 , please be patient. |
@adamchainz Thanks for this patch 👍 I pushed edits to docs. What do you think about suppressing |
I think suppressing the exception makes sense. Django is passing the arguments through and the error is raised by the external process which has already thrown messages to the console. I was going to say reraising was not needed, but if scripted it could be handy to know which exact command failed. |
Sorry about my impatience @felixxm 🙈 Agree with both that suppressing the exception makes sense. It already breaks some workflows before passing options through. The reraise of proc = subprocess.run(...)
sys.exit(proc.returncode) This means Django is "transparent" around the command - it won't create any output but still exits with the same code. It's much more like its behaviour using |
8ab2100
to
019ebbb
Compare
This approach breaks usage with |
I am not sure use of I think it's important to preserve the return code, especially when adding the ability to use custom flags. Which return code was used can carry extra meaning. I've made the |
I've also changed to |
019ebbb
to
c197923
Compare
Management commands are expected to raise
I think we need to stick with that. |
c197923
to
5ee804c
Compare
Okay done. To preserve the return code I added the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@adamchainz Thanks 👍 Please reorganize commits, we shouldn't mix (multiple) cleanups with a new feature.
5ee804c
to
fdf8523
Compare
Apologies for my unsplit commits. I think I've done it with good enough naming now. |
@adamchainz Thanks 👍 I added tests for missing |
All LGTM |
e6f6d3b
to
5b884d4
Compare
Ticket