From 642855c952c71d7db74d3389a178bd447fae6316 Mon Sep 17 00:00:00 2001 From: Frantisek Hrbata Date: Sat, 30 Nov 2024 17:31:39 +0100 Subject: [PATCH] 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 --- tools/idf_py_actions/tools.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tools/idf_py_actions/tools.py b/tools/idf_py_actions/tools.py index 0f4cb73a1d..2a81101d31 100644 --- a/tools/idf_py_actions/tools.py +++ b/tools/idf_py_actions/tools.py @@ -434,6 +434,8 @@ class RunTool: # 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 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: if self.interactive: output = await read_interactive_stream()