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
5 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159