Skip to content

Commit

Permalink
Make run_in_new_terminal work on OSX under tmux
Browse files Browse the repository at this point in the history
  • Loading branch information
zachriggle committed Apr 12, 2016
1 parent d4f10b0 commit 60e5a80
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pwnlib/util/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import errno
import os
import re
import platform
import socket
import stat
import string
Expand Down Expand Up @@ -213,9 +214,11 @@ def run_in_new_terminal(command, terminal = None, args = None):
log.debug("Launching a new terminal: %r" % argv)

if os.fork() == 0:
os.close(0)
os.close(1)
os.close(2)
# Closing the file descriptors makes everything fail under tmux on OSX.
if platform.system() != 'Darwin':
os.close(0)
os.close(1)
os.close(2)
os.execv(argv[0], argv)
os._exit(1)

Expand Down

0 comments on commit 60e5a80

Please sign in to comment.