forked from Lainports/freebsd-ports
- select can be interrupted and return EINTR so we need to loop around it while it does so rather than treating it as a fatal error. - all process creations are matched with a wait() so having a SIGCHLD handler that performs a wait(-1) is pointless and racy. We tend to loose the race over half the time and as a result were reporting successful processes as failed. Add a couple features: - Skip commented lines in the host specification. - Allow '-' as an alias for stdin in the host file specification.
28 lines
1 KiB
Python
28 lines
1 KiB
Python
|
|
$FreeBSD$
|
|
|
|
--- psshlib/basethread.py.orig
|
|
+++ psshlib/basethread.py
|
|
@@ -1,4 +1,4 @@
|
|
-import color, cStringIO, fcntl, os, select, signal, sys, threading, time, Queue
|
|
+import color, cStringIO, errno, fcntl, os, select, signal, sys, threading, time, Queue
|
|
from subprocess import Popen, PIPE
|
|
|
|
class BaseThread(threading.Thread):
|
|
@@ -35,7 +35,15 @@
|
|
timeout = self.flags["timeout"] - (time.time() - start)
|
|
if timeout <= 0:
|
|
raise Exception("Timeout")
|
|
- r, w, e = select.select([ cstdout, cstderr ], [], [], timeout)
|
|
+ while True:
|
|
+ try:
|
|
+ r, w, e = select.select([ cstdout, cstderr ], [], [], timeout)
|
|
+ break
|
|
+ except select.error, v:
|
|
+ if v[0] == errno.EINTR:
|
|
+ continue
|
|
+ else:
|
|
+ raise
|
|
try:
|
|
for f in r:
|
|
chunk = f.read()
|