Bug 1285059 Do not use signal.pause r=kmag
authorAndrew Swan <aswan@mozilla.com>
Wed, 06 Jul 2016 16:49:36 -0700
changeset 330125 82ae790de9889e8531cbc4d82b76259a1fd8d14d
parent 330023 683bf5d3c1cdd76799d7da01d3a0cd2dbb42e8f9
child 330126 058b26df0165c0cf78f3cde249bd10e8a474dcc0
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskmag
bugs1285059
milestone50.0a1
Bug 1285059 Do not use signal.pause r=kmag MozReview-Commit-ID: JKTbFMktx8Y
toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html
--- a/toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html
+++ b/toolkit/components/extensions/test/mochitest/test_chrome_ext_native_messaging.html
@@ -105,23 +105,32 @@ sys.stdout.write(struct.pack('@I', len(m
 sys.stdout.write(msg)
 sys.exit(0)
 `;
 
 const WONTDIE_BODY = String.raw`
 import signal
 import struct
 import sys
+import time
 
 signal.signal(signal.SIGTERM, signal.SIG_IGN)
 
+def spin():
+    while True:
+        try:
+            signal.pause()
+        except AttributeError:
+            time.sleep(5)
+
 while True:
     rawlen = sys.stdin.read(4)
     if len(rawlen) == 0:
-        signal.pause()
+        spin()
+
     msglen = struct.unpack('@I', rawlen)[0]
     msg = sys.stdin.read(msglen)
 
     sys.stdout.write(struct.pack('@I', msglen))
     sys.stdout.write(msg)
 `;
 
 const STDERR_LINES = ["hello stderr", "this should be a separate line"];