Skip to content
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

Default suggested command does not always work #298

Open
mnalli opened this issue Aug 8, 2021 · 1 comment
Open

Default suggested command does not always work #298

mnalli opened this issue Aug 8, 2021 · 1 comment

Comments

@mnalli
Copy link

mnalli commented Aug 8, 2021

If I call for instance realgud:pdb on a on a python file that contains spaces in the name, the suggested command line to execute is similar to the following: python -m pdb /absolute/path/this\ is\ a\ test.py.

The debugger exits immediately with an error, printing the following lines:

Making font-lock-breakpoint-keywords buffer-local while locally let-bound!
using pdb mode map
Making kill-buffer-hook buffer-local while locally let-bound!
That’s all folks.... exited abnormally with code 1

The debugger starts correctly if I manually change the suggested line adding quotes this way: python -m pdb "/absolute/path/is a test.py"

Is there a way to change the default suggestion so that I don't have to manually change it every time?

@rocky
Copy link
Collaborator

rocky commented Aug 8, 2021

Here is what seems to be happening. realgud-suggest-invocation is what is suggesting the file in the invocation. It uses the shell-quote-argument function from subtr.el which decides to add the backslashes.

So far so good I suppose. Then in realgud: run-debugger the command line is parsed to try to figure out the file part of the script and if there are special options it might need to deal with. The function it uses there is split-string-and-unquote which is another function from subr.el Somewhere between these two standard Elisp functions packing and unpacking arguments isn't round tripping.

Maybe there is a better pair to use?

I'll note though that once the command is corrected, the corrected name gets into the history of invocations, and that can be used to retrieve the command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants