Skip to content

Commit

Permalink
Make sure TERM_PROGRAM points to a valid program
Browse files Browse the repository at this point in the history
Visual Studio Code sets the $TERM_PROGRAM environment variable to `"vscode"` in its terminal pane,
but doesn't support opening new panes from the command line and there is no "vscode" binary.

Make sure the target binary exists before trying to launch it.
  • Loading branch information
peace-maker committed Jan 3, 2024
1 parent d289e17 commit b5555b1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pwnlib/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr
elif 'STY' in os.environ and which('screen'):
terminal = 'screen'
args = ['-t','pwntools-gdb','bash','-c']
elif 'TERM_PROGRAM' in os.environ:
elif 'TERM_PROGRAM' in os.environ and which(os.environ['TERM_PROGRAM']):
terminal = os.environ['TERM_PROGRAM']
args = []
elif 'DISPLAY' in os.environ and which('x-terminal-emulator'):
Expand Down

0 comments on commit b5555b1

Please sign in to comment.