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

Wrap commands cont. ';' in sh when $SHELL == zsh #635

Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pwnlib/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ def run_in_new_terminal(command, terminal = None, args = None):
elif 'TMUX' in os.environ:
terminal = 'tmux'
args = ['splitw']
if 'zsh' in os.environ['SHELL'] and ';' in command:
# zsh and tmux have issues with handling SIGINT
# wrapping command with sh -c (and escaping single quotes) works around this
command = "sh -c '" + command.replace("\\", "\\\\").replace("'", "'\\\\\\''") + "'"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have sh_escape for exactly this reason

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll take a look


if not terminal:
log.error('Argument `terminal` is not set, and could not determine a default')
Expand Down