summary refs log tree commit diff stats
path: root/ranger/ext/waitpid_no_intr.py
diff options
context:
space:
mode:
Diffstat (limited to 'ranger/ext/waitpid_no_intr.py')
-rw-r--r--ranger/ext/waitpid_no_intr.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/ranger/ext/waitpid_no_intr.py b/ranger/ext/waitpid_no_intr.py
new file mode 100644
index 00000000..38df44ee
--- /dev/null
+++ b/ranger/ext/waitpid_no_intr.py
@@ -0,0 +1,12 @@
+def waitpid_no_intr(pid):
+	""" catch interrupts which occur while using os.waitpid """
+	import os, errno
+
+	while True:
+		try:
+			return os.waitpid(pid, 0)
+		except OSError as e:
+			if e.errno == errno.EINTR:
+				continue
+			else:
+				raise