delve
delve copied to clipboard
Exit from attached process without prompt
When using dlv attach to debug local running process, it's really annoying to answer the prompt
Would you like to kill the process? [Y/n]
It slows the debugging flow a lot and this question is not something critical when debugging a local process.
I propose that config param is introduced which could set allow user that prefers not to kill running process.
Already did some implementation which introduces config param
soft-detach: true
If param is true it will skip the yesno
question, and will exit from dlv without killing the process.
If this is something that could be useful, I can submit PR request, but wanted to discuss this enhancement here first.
I'm skeptical that pressing two keys "slows the debugging flow a lot"
:) maybe 'a lot' is a too strong word, I agree.
Since I'm always answering the same answer to yesno
question, I wanted to find a way to automate it.
If this is not interesting enhancement, you can close the issue. I'm going to use that in my flow.
I think it would be reasonable to add arguments to the exit
command that control what it does instead of asking the user, and it would also be reasonable to extend the alias mechanism config alias...
to allow defining an alias to a command+arguments. Adding an option just for this does too little.
Is it OK to reuse the same exit -c
argument to exit without prompt?
It's different client, so it won't conflict with current usage of exit -c
.
Then I would look how to extend alias mechanism to allow command+arguments.
It would be ambiguous, when connected to a headless instance attached to a process would exit -c
mean "disconnect, terminate headless instance, detach from process (without killing)" or "disconnect, keep headless instance running, resume attached process"
So then new argument should be implemented, if this one is ambiguous. Which one would be appropriate? Maybe exit -d (as detach)
Hi, I have another use-case for something like this.
Im currently automating the deployment of a daemonised application in "debug mode", where it runs as normal, but is wrapped in a headless delve server which allows clients to connect debug clients remotely.
Directly after starting the headless server (as part of an automated script), I want my application (the daemon) to immediately begin executing like it normally would, so after I call dlv --headless exec mydaemon
, I immediately auto-connect a debug client with an init file, which just says:
continue
exit
However, because the client requires human input (y
), that automated client actually cannot kill itself (I need to instead kill the process) with kill
.
I'd be very much in favour of a -y
flag similar to what pkg managers like apt
and yum
offer, which automatically say "yes" (or "no") to any anti-automation prompts like this.
I'd be very happy to PR this feature if you'd be happy to accept it! :) let me know
Hi, I have another use-case for something like this.
Im currently automating the deployment of a daemonised application in "debug mode", where it runs as normal, but is wrapped in a headless delve server which allows clients to connect debug clients remotely.
Directly after starting the headless server (as part of an automated script), I want my application (the daemon) to immediately begin executing like it normally would, so after I call
dlv --headless exec mydaemon
, I immediately auto-connect a debug client with an init file, which just says:continue exit
However, because the client requires human input (
y
), that automated client actually cannot kill itself (I need to instead kill the process) withkill
.I'd be very much in favour of a
-y
flag similar to what pkg managers likeapt
andyum
offer, which automatically say "yes" (or "no") to any anti-automation prompts like this. I'd be very happy to PR this feature if you'd be happy to accept it! :) let me know
If I understand correctly your use case can be solved already via dlv debug --headless --continue
which will accomplish what your init script does but without the headache you mention.
I would most likely accept a patch which implements this feature if folks feel strongly enough about it.
(Sorry, clicked wrong button and did not mean to close).
Hi I would like this feature too. I'd like to write a script that automates generating a list of functions for me. Something like:
gen-funcs.dlv
transcript -x funcs.out
funcs
exit -y
And then I can attach to the binary and do
dlv source gen-funcs.dlv