summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rwxr-xr-xtests/wqueue.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/tests/wqueue.py b/tests/wqueue.py
index 837fb26..528a10c 100755
--- a/tests/wqueue.py
+++ b/tests/wqueue.py
@@ -4,16 +4,27 @@ import fcntl
import time
import subprocess
import os
+import asyncio
QUEUE_FILE = 'queue.txt'
COMMAND = './command.sh'
+loop = asyncio.get_event_loop()
+
+class JobHandler(asyncio.SubprocessProtocol):
+ def process_exited(self):
+ print()
+
def do_job(command=None, arg=None):
assert(command)
assert(arg)
print('arg:', arg)
print('doing operation with arg')
- ret = subprocess.check_call([command, arg])
+ #ret = subprocess.check_call([command, arg])
+ loop.suprocess_exec([command, arg],
+ stdin=subprocess.DEVNULL,
+ stdout=sys.stdout,
+ stderr=sys.stderr)
print('ret:', ret)
return ret == 0
@@ -34,11 +45,19 @@ def pop_job_arg():
fo.write(line)
os.rename(queue_tmp, queue)
+def check_queue():
+ #loop = asyncio.get_event_loop()
+ #loop.run_forever()
+
+
#with open('queue.txt', 'w') as f:
# fcntl.lockf(f, fcntl.LOCK_EX)
# time.sleep(9999)
-while True:
- job_arg = read_next_job_arg()
- if do_job(command=COMMAND, arg=job_arg):
- pop_job_arg()
+#while True:
+# job_arg = read_next_job_arg()
+# if do_job(command=COMMAND, arg=job_arg):
+# pop_job_arg()
+
+#loop = asyncio.get_event_loop()
+loop.run_forever()