forked from M-Labs/artiq
1
0
Fork 0

kasli_tester: add support for windows platform. (#1204)

This commit is contained in:
Kaifeng 2018-12-05 21:06:45 +08:00 committed by Sébastien Bourdeauducq
parent 6aa341bc44
commit cc143d5fec
1 changed files with 14 additions and 4 deletions

View File

@ -1,8 +1,12 @@
import sys
import os
import select
from artiq.experiment import *
if os.name == "nt":
import msvcrt
def chunker(seq, size):
res = []
@ -16,11 +20,17 @@ def chunker(seq, size):
def is_enter_pressed() -> TBool:
if select.select([sys.stdin,], [], [], 0.0)[0]:
sys.stdin.read(1)
return True
if os.name == "nt":
if msvcrt.kbhit() and msvcrt.getch() == b"\r":
return True
else:
return False
else:
return False
if select.select([sys.stdin, ], [], [], 0.0)[0]:
sys.stdin.read(1)
return True
else:
return False
class KasliTester(EnvExperiment):