Skip to content

Commit 7f86a1a

Browse files
committed
[core/process] Fix a problem >&100 does not fail.
1 parent abe89a5 commit 7f86a1a

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

core/process.py

+7
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ def _PushDup(self, fd1, loc):
257257
# already returned 3, e.g. echo 3>out.txt
258258
return NO_FD
259259

260+
# Check the validity of fd1 before _PushSave(fd2)
261+
try:
262+
fcntl.fcntl(fd1, fcntl.F_GETFD)
263+
except IOError as e:
264+
self.errfmt.Print('%d: %s', fd1, posix.strerror(e.errno))
265+
raise
266+
260267
need_restore = self._PushSave(fd2)
261268

262269
#log('==== dup2 %s %s\n' % (fd1, fd2))

0 commit comments

Comments
 (0)