Skip to content

Commit

Permalink
Stop using cmd.exe to keep current directory (#2488)
Browse files Browse the repository at this point in the history
* Stop using cmd.exe to keep current directory

* Update misc.py

* Update misc.py, deal with cmd.exe

* Update misc.py
  • Loading branch information
robbert1978 authored Oct 24, 2024
1 parent 34da249 commit 7dceedd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pwnlib/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,13 +370,13 @@ def run_in_new_terminal(command, terminal=None, args=None, kill_at_exit=True, pr
terminal = 'cmd.exe'
args = ['/c', 'start']
distro_name = os.getenv('WSL_DISTRO_NAME')
current_dir = os.getcwd()

# Split pane in Windows Terminal
if 'WT_SESSION' in os.environ and which('wt.exe'):
args.extend(['wt.exe', '-w', '0', 'split-pane', '-d', '.'])

args.extend(['wt.exe', '-w', '0', 'split-pane'])
if distro_name:
args.extend(['wsl.exe', '-d', distro_name, 'bash', '-c'])
args.extend(['wsl.exe', '-d', distro_name, '--cd', current_dir, 'bash', '-c'])
else:
args.extend(['bash.exe', '-c'])

Expand Down

0 comments on commit 7dceedd

Please sign in to comment.