Skip to content
Snippets Groups Projects
Commit bd0c9239 authored by Nicola Sparnacci's avatar Nicola Sparnacci
Browse files

[CORE] Update script sourcing to print stderr to console


The function `source_script` that runs scripts in source mode, has the
method `subprocess.run` that now:
- redirects the stdout to python in order to process the output
- regularly print to terminal stderr (it can be expoited in post-scripts to
print to the user).

Signed-off-by: default avatarNicola Sparnacci <nicola.sparnacci@seco.com>
parent 43e5d52d
No related branches found
No related tags found
1 merge request!30[POST-SCRIPTS][CORE] Update script sourcing and remove duplicate warnings
......@@ -105,10 +105,12 @@ def source_script(script_path, *args, cwd=None):
args_str = ' '.join(args)
command = f"bash -c 'source {script_path} {args_str} > /dev/null; env'"
# Run the command and capture the environment variables
# Run the command and capture the environment variables. stdout is
# redirected to python so that it can be processed and it's not
# printed. stderr, instead, is printed to the terminal.
result = subprocess.run(command, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stderr=None,
universal_newlines=True,
cwd=cwd)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment