Skip to content

Commit 867a388

Browse files
committed
improve error handling robustness for os.execvpe
see: pexpect/pexpect#512
1 parent 5436e55 commit 867a388

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ptyprocess/ptyprocess.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,11 @@ def spawn(
292292
os.write(exec_err_pipe_write, tosend)
293293
os.close(exec_err_pipe_write)
294294
os._exit(os.EX_OSERR)
295+
except Exception as err:
296+
cls_name = err.__class__.__name__
297+
os.write(exec_err_pipe_write, 'Exception:0:{}: {}'.format(cls_name, str(err)))
298+
os.close(exec_err_pipe_write)
299+
os._exit(os.EX_OSERR)
295300

296301
# Parent
297302
inst = cls(pid, fd)

0 commit comments

Comments
 (0)