mirror of
https://github.com/espressif/esp-idf.git
synced 2025-07-31 19:24:33 +02:00
Merge branch 'bugfix/log-error-run-esptool_v4.1' into 'release/v4.1'
parttool.py: Add file stream parameter and log stdout and stderr to same stream (v4.1) See merge request espressif/esp-idf!10517
This commit is contained in:
@@ -117,6 +117,9 @@ class ParttoolTarget():
|
|||||||
|
|
||||||
self.partition_table = partition_table
|
self.partition_table = partition_table
|
||||||
|
|
||||||
|
# set `out` to None to redirect the output to the STDOUT
|
||||||
|
# otherwise set `out` to file descriptor
|
||||||
|
# beware that the method does not close the file descriptor
|
||||||
def _call_esptool(self, args, out=None):
|
def _call_esptool(self, args, out=None):
|
||||||
esptool_args = [sys.executable, ESPTOOL_PY] + self.esptool_args
|
esptool_args = [sys.executable, ESPTOOL_PY] + self.esptool_args
|
||||||
|
|
||||||
@@ -128,8 +131,12 @@ class ParttoolTarget():
|
|||||||
|
|
||||||
esptool_args += args
|
esptool_args += args
|
||||||
|
|
||||||
with open(os.devnull, "w") as null_file:
|
print("Running %s..." % (" ".join(esptool_args)))
|
||||||
subprocess.check_call(esptool_args, stdout=null_file, stderr=null_file)
|
try:
|
||||||
|
subprocess.check_call(esptool_args, stdout=out, stderr=subprocess.STDOUT)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
print("An exception: **", str(e), "** occurred in _call_esptool.", file=out)
|
||||||
|
raise e
|
||||||
|
|
||||||
def get_partition_info(self, partition_id):
|
def get_partition_info(self, partition_id):
|
||||||
partition = None
|
partition = None
|
||||||
|
Reference in New Issue
Block a user