Skip to content

Commit ad00063

Browse files
authored
Merge pull request #76061 from swiftlang/revert-76009-test-timeout-error-message
Revert "[Test] Make timeout.py signal an error when the timeout is hit."
2 parents 7abd889 + fcbb6b0 commit ad00063

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

test/Inputs/timeout.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
import subprocess
44
import sys
5+
import threading
56

67

78
def watchdog(command, timeout=None):
89
process = subprocess.Popen(command)
10+
timer = threading.Timer(timeout, process.kill)
911
try:
10-
process.communicate(timeout=timeout)
11-
except subprocess.TimeoutExpired:
12-
process.kill()
13-
sys.exit(
14-
'error: command timed out after {} seconds: {}'
15-
.format(timeout, ' '.join(sys.argv[2:])))
12+
timer.start()
13+
process.communicate()
14+
finally:
15+
timer.cancel()
1616

1717

1818
if __name__ == '__main__':

0 commit comments

Comments
 (0)