Skip to content

Commit e466f5c

Browse files
authored
Make sure TERM_PROGRAM points to a valid program (#2329)
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.
1 parent 171d9df commit e466f5c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pwnlib/util/misc.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr
307307
elif 'STY' in os.environ and which('screen'):
308308
terminal = 'screen'
309309
args = ['-t','pwntools-gdb','bash','-c']
310-
elif 'TERM_PROGRAM' in os.environ:
310+
elif 'TERM_PROGRAM' in os.environ and which(os.environ['TERM_PROGRAM']):
311311
terminal = os.environ['TERM_PROGRAM']
312312
args = []
313313
elif 'DISPLAY' in os.environ and which('x-terminal-emulator'):

0 commit comments

Comments
 (0)