|
|
|
|
|
by arielb1
1909 days ago
|
|
When calling shell from bash (to use pipes etc.), I found it useful to pass variables via the environment, like this: def safe_call(command, **keywds):
return subprocess.check_call(f'set -euo pipefail; {command}', shell=True, env=keywds)
safe_call('command1 -- "$bar" | command2 --baz="$baz" | command3 > "$output_file"', bar=bar, baz=baz, output_file=output_file)
|
|