[crosperf] RunCommand can't output cros flash usb |
|||||||||||||||
Issue description
I'm trying to flash a ChromeOS image to usb through the command_executer module via RunCommand. However it seems the "cros flash usb://" output hijacks my stdout/terminal causing it to be impossible for users to feasibly provide input.
To reproduce run this python code inside toolchain-utils in your chroot:
from utils import command_executer
ce = command_executer.GetCommandExecuter()
ce.RunCommand('cros flash usb:// ~/trunk/src/build/images/daisy/latest/chromiumos_test_image.bin')
The usb device prompt never shows up and the program appears to hang. If you input 0 then the prompt will show up after the fact.
,
Jun 9 2016
,
Jun 9 2016
There actually appears to be two separate problems here related to RunCommand/cros flash: 1. RunCommand won't output the prompt from cros flash usb://. This is solved by doing the following: "export PYTHONUNBUFFERED=1". Not sure why this is required, it appears that cros flash has a weird buffered outputting mechanism? And this isn't compatible with RunCommand's output polling? 2. If you ctrl-c inside a RunCommand invocation this can leave your terminal unusable. It seems the problem is the child process stays alive even if the program invoking RunCommand dies from a KeyboardInterrupt. I've submitted a patch to add a function that handles this edge case: https://chrome-internal-review.googlesource.com/#/c/263665/ However, other users will have to opt-in and use this specific function if they want their RunCommand's protected from a stray KeyboardInterrupt/misc. exception.
,
Jun 9 2016
,
Jun 10 2016
The following revision refers to this bug: https://chrome-internal.googlesource.com/chromeos/toolchain-utils/+/a02937d6530b19b5635119a3f40169a604b0ca26 commit a02937d6530b19b5635119a3f40169a604b0ca26 Author: Cassidy Burden <cburden@google.com> Date: Wed Jun 08 23:34:23 2016
,
Jun 13 2016
The following revision refers to this bug: https://chrome-internal.googlesource.com/chromeos/toolchain-utils/+/333fe383dcd0c35981a5473bc913d07b52c310a1 commit 333fe383dcd0c35981a5473bc913d07b52c310a1 Author: Cassidy Burden <cburden@google.com> Date: Mon Jun 13 17:02:04 2016
,
Jun 14 2016
,
Jun 14 2016
,
Jul 1 2016
,
Aug 29 2016
,
Oct 7 2016
,
Nov 19 2016
,
Jan 21 2017
,
Mar 4 2017
,
Apr 17 2017
,
May 30 2017
,
Aug 1 2017
,
Aug 3 2017
Closing. Please reopen it if its not fixed. Thanks! |
|||||||||||||||
►
Sign in to add a comment |
|||||||||||||||
Comment 1 by cmt...@chromium.org
, Jun 8 2016