forked from espressif/esp-idf
feat(tools): add command arguments in the logs produced by RunTool
Currrently, all logs generated by RunTool are stored in files named idf_py_(stdout|stderr)_output_$$, making it difficult to identify which log corresponds to which command. To simplify this for idf-diag, include the command arguments at the beginning of the log. This will allow idf-diag to use regex to differentiate logs for build, monitor, flash, and other commands and targets. Signed-off-by: Frantisek Hrbata <frantisek.hrbata@espressif.com>
This commit is contained in:
@@ -434,6 +434,8 @@ class RunTool:
|
|||||||
# contains CRLF. Use "newline=''" to prevent python to convert CRLF into CRCRLF.
|
# contains CRLF. Use "newline=''" to prevent python to convert CRLF into CRCRLF.
|
||||||
# Please see "newline" description at https://docs.python.org/3/library/functions.html#open
|
# Please see "newline" description at https://docs.python.org/3/library/functions.html#open
|
||||||
with open(output_filename, 'w', encoding='utf8', newline='') as output_file:
|
with open(output_filename, 'w', encoding='utf8', newline='') as output_file:
|
||||||
|
# Log the command arguments.
|
||||||
|
output_file.write('Command: {}\n'.format(' '.join(self.args)))
|
||||||
while True:
|
while True:
|
||||||
if self.interactive:
|
if self.interactive:
|
||||||
output = await read_interactive_stream()
|
output = await read_interactive_stream()
|
||||||
|
Reference in New Issue
Block a user