-
-
Notifications
You must be signed in to change notification settings - Fork 762
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
get pty by tmux command and close pane when gdb exit #881
Conversation
gef.py
Outdated
old_ptses = set(os.listdir("/dev/pts")) | ||
gdb.execute(f"! {tmux} split-window -h 'clear ; cat'") | ||
|
||
pane_info = subprocess.check_output(["tmux", "splitw", "-h",'-F#{session_name}:#{window_index}.#{pane_index}-#{pane_tty}', "-P"]).decode().strip().split("-") |
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.
this should be tmux
not "tmux"
, and double quotes around the long arg.
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.
double quotes will not work here
gef.py
Outdated
pane_info = subprocess.check_output(["tmux", "splitw", "-h",'-F#{session_name}:#{window_index}.#{pane_index}-#{pane_tty}', "-P"]).decode().strip().split("-") | ||
pane = pane_info[0] | ||
pty = pane_info[1] | ||
atexit.register(lambda : os.system(f"{tmux} kill-pane -t {pane}")) |
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.
Why not use subprocess
here?
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.
use subprocess.run now
dd9edbf
to
76461eb
Compare
gef.py
Outdated
pty = pane_info[1] | ||
atexit.register(lambda : subprocess.run([tmux, "kill-pane", "-t", pane])) | ||
|
||
gdb.execute(f"! {tmux} send-keys -t {pane} 'clear;sleep infinity' C-m") |
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.
Can you add a comment explaining why you need these keys to be sent?
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.
Can you add a comment explaining why you need these keys to be sent?
okay, I add a comment and still use cat
.
Signed-off-by: roderick <[email protected]>
Co-authored-by: crazy hugsy <[email protected]>
Signed-off-by: roderick [email protected]
Description/Motivation/Screenshots
Sometimes, the old method
list(new_ptses - old_ptses)[0]
cannot get the right pty while meeting other tmux-pty operations at the same time. And it's better to kill the pane generated by tmux after quitting gdb.Against which architecture was this tested ?
"Tested" indicates that the PR works and the unit test (i.e.
make test
) run passes without issue.Checklist
dev
branch, notmain
.