0

when I use subprocess.Popen to runn cts it always get into Non-interactive mode then stopped.

Non-interactive mode: Running initial command then exiting.

Below is the code I used.

subprocess.Popen(command_list, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

Android CTS 5.1_r5 Non-interactive mode: Running initial command then exiting. Using commandline arguments as starting command: [run, cts, --plan, CTS, -s, JS2U300154120087, --disable-reboot] 02-27 17:49:09 I/DeviceManager: Detected new device JS2C300154455332 02-27 17:49:09 I/DeviceManager: Detected new device JS2U300154120087 02-27 17:49:09 I/TestInvocation: Starting invocation for 'cts' on build '5.1_r5' on device JS2U300154120087 02-27 17:49:09 I/JS2U300154120087: Created result dir 2016.02.27_17.49.09 02-27 17:49:10 I/CtsTest: ABIs: [armeabi-v7a, arm64-v8a]

R. Michael
  • 21
  • 1
  • "non-interactive" may refer to `sys.stdout.isatty()` (its analog inside `cts`) returning false. `stdout=PIPE` and therefore it is not a tty. On Unix, you can [try `pexpect`, `pty` modules, to get subprocess' output as if it were connected to a tty](http://stackoverflow.com/a/12471855/4279). See also, [Last unbuffered line can't be read](http://stackoverflow.com/q/25923901/4279). What is the host system (where the parent Python process is run)? – jfs Feb 27 '16 at 18:20
  • @J.F.Sebastian the host system is Linux ubuntu 12.04 LTS. – R. Michael Feb 29 '16 at 04:49
  • @J.F.Sebastian thanks for your answer, it works with stdout=sys.stdout.isatty(), now I am blocked on how to get the real time output. – R. Michael Feb 29 '16 at 06:03
  • `isatty()` returns True/False. It is not appropriate to pass it as Popen's `stdout`. Read its docs. Follow the links, to see code examples on how to get the output. – jfs Feb 29 '16 at 12:35
  • @J.F.Sebastian thanks – R. Michael Mar 04 '16 at 12:34

0 Answers0