diff options
author | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2008-03-19 21:11:01 +0000 |
---|---|---|
committer | noah <noah@656d521f-e311-0410-88e0-e7920216d269> | 2008-03-19 21:11:01 +0000 |
commit | ed3d259ce0d384ce4b0cac650331de0494e3aeb9 (patch) | |
tree | 7f1a6085762fc7e40ce437defab3c1fcf11aeaff /pexpect | |
parent | 71026476361422f638c9275276db72b34f40b506 (diff) | |
download | pexpect-ed3d259ce0d384ce4b0cac650331de0494e3aeb9.tar.gz |
Patch from Jan Grant for solaris cron.
git-svn-id: http://pexpect.svn.sourceforge.net/svnroot/pexpect/trunk@514 656d521f-e311-0410-88e0-e7920216d269
Diffstat (limited to 'pexpect')
-rw-r--r-- | pexpect/pexpect.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/pexpect/pexpect.py b/pexpect/pexpect.py index 4d3fdc6..fda6a5c 100644 --- a/pexpect/pexpect.py +++ b/pexpect/pexpect.py @@ -35,8 +35,8 @@ Robert Stone, Hartmut Goebel, Chad Schroeder, Erick Tryzelaar, Dave Kirby, Ids vander Molen, George Todd, Noel Taylor, Nicolas D. Cesar, Alexander Gattin, Geoffrey Marshall, Francisco Lourenco, Glen Mabey, Karthik Gurusamy, Fernando Perez, Corey Minyard, Jon Cohen, Guillaume Chazarain, Andrew Ryan, Nick -Craig-Wood, Andrew Stone, Jorgen Grahn, John Spiegel (Let me know if I forgot -anyone.) +Craig-Wood, Andrew Stone, Jorgen Grahn, John Spiegel, Jan Grant (Let me know if +I forgot anyone.) Free, open source, and all that good stuff. @@ -613,9 +613,13 @@ class spawn (object): child_name = os.ttyname(tty_fd) # Disconnect from controlling tty if still connected. - fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY); - if fd >= 0: - os.close(fd) + try: + fd = os.open("/dev/tty", os.O_RDWR | os.O_NOCTTY); + if fd >= 0: + os.close(fd) + except: + # We are already disconnected. Perhaps we are running inside cron. + pass os.setsid() |