summaryrefslogtreecommitdiff
path: root/tools/halt.py
diff options
context:
space:
mode:
authorMagnus Ahltorp <map@kth.se>2015-03-31 19:35:13 +0200
committerMagnus Ahltorp <map@kth.se>2015-03-31 19:35:13 +0200
commit8c5b1dbba571456e3b68bcf25e4ca9db9b7b669b (patch)
treee854b29ae7f24c201c1ffdd62d70123774cad0e1 /tools/halt.py
parent13c3789add4f1630c4bc8dfccb229ebc7d4bfa38 (diff)
Wait 0.5 seconds after writing halt command
Diffstat (limited to 'tools/halt.py')
-rwxr-xr-xtools/halt.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/halt.py b/tools/halt.py
index cfbf14e..0cb43ed 100755
--- a/tools/halt.py
+++ b/tools/halt.py
@@ -7,6 +7,7 @@
import argparse
import subprocess
import sys
+import select
parser = argparse.ArgumentParser(description='')
parser.add_argument('toerl')
@@ -16,4 +17,8 @@ args = parser.parse_args()
p = subprocess.Popen(
[args.toerl, args.nodedir],
stdin=subprocess.PIPE)
-p.communicate("halt().\n")
+p.stdin.write("halt().\n")
+p.stdin.flush()
+select.select([], [], [], 0.5)
+p.stdin.close()
+p.wait()