-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Split command before adding to argv #1725
Conversation
I would rather modify run_in_new_terminal to build up a list of args -- which are only joined at the end -- rather than using This should also help avoid cases where we're inadvertently introducing quotes into the arguments. |
I tried using |
Rather than using shlex.split, we should just keep the arguments as an array and only join them at the end if needed. We also have sh_string which does the "right" amount of quoting, for passing an actual shell (vs. shlex.split). |
Correct me if I'm misunderstanding, but that was what I tried to do that with
But this results in the terminal closing immediately for some reason (I tested on kitty, termite, and xterm). I'm trying to use |
After looking at |
It operates on an array -- my suggestion is to keep all of the arguments as separate in an array, then only join them with sh_string when needed. |
Sorry, I'm not sure I understand. For my example, if I do
How would I determine when/where I would need to join elements? Or do you mean that I should go through each element and run it through |
I think e.g. don't join the arguments before calling the function and then try to split them again. Line 878 in d466fa9
|
- Revert run_in_new_terminal, add comment about potentially needing to split
Thanks for the clarification. I changed the
I can't seem to find an easy way to resolve this unfortunately |
That's great! I hate dealing with strings and lexing/parsing/splitting/joining stuff where it would be possible to just use lists of them in the first place. For the circular imports, you can always import whole modules, so a plain from . import sh_string and later s = sh_string.sh_string(s) would totally suffice IMO. |
Thanks for the suggestion, I tried that but unfortunately it didn't work :(
|
This may aid Gallopsled#1725
Superseded by #1846 |
* Cleanup unconditional imports This may aid #1725 * Import explicitly * Add good ol' SIGALRM-based debugs for tests * Fix py2 GDB tests somehow XXX: see why this matters * Update CHANGELOG.md
Summary: Make
gdb.attach
work for kitty (and potentially other terminals?) by splittingcommand
before adding it toargv
.Details
I noticed that using
gdb.attach
with kitty terminal results in:Here was the test program I used:
And here was the output when I ran the script:
It seems like the issue is here:
This should be:
To resolve this I just split
command
on whitespaces before adding it toargv
.