Dne 06. 02. 19 v 7:22 Fajun Chen napsal(a):
> Hi Lukas,
>
> As an experiment, I made the following changes to avocado/core/runner.py:
> @@ -319,7 +319,7 @@
> # be able to read from the tty, and would hang. Let's replace
> # STDIN fd (0), with the same fd previously set by
> # `multiprocessing.Process()`
> - os.dup2(sys.stdin.fileno(), 0)
> + # os.dup2(sys.stdin.fileno(), 0)
>
> instance = loader.load_test(test_factory)
> if instance.runner_queue is None:
> @@ -349,7 +349,10 @@
> TEST_LOG.info(' %s: %s', source, location)
> TEST_LOG.info('')
> try:
> + sys.stdin = open(0)
> instance.run_avocado()
> + sys.stdin.close()
> + sys.stdin = open(os.devnull)
> finally:
> try:
> state = instance.get_state()
>
> I can interact with the test manually with the change. Understood the risk
> of keeping stdin fd open, but will it be manageable if our tests don't read
> from tty unless it's warranted?
>
> Thanks,
> FajunHello Fajun, sure, this will work for now (although failures are not handled), anyway if you decide to use Avocado I'd suggest the RFC or at least to open a discussion to have a proper implementation. I can imagine something like: ``` avocado run interactive.py --enable-stdin JOB ID : 8e9a0a9011d3e4b31d0fee5c2f727e32cf08ec7a JOB LOG : /home/medic/avocado/job-results/job-2019-02-08T17.05-8e9a0a9/job.log (1/1) interactive.py:InteractiveTest.test: Waiting on stdin on localhost:12345 \ PASS (75.75 s) RESULTS : PASS 1 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 0 | CANCEL 0 JOB TIME : 75.88 s JOB HTML : /home/medic/avocado/job-results/job-2019-02-08T17.05-8e9a0a9/results.html ``` (or even to use STDIN directly, but as one would perhaps like to see the stdout as well I think it'd be better to use socket and pipe in/out/err there...) Regards, Lukáš
signature.asc
Description: OpenPGP digital signature
