Following on from the discussion about exporting environment variables for use in userscripts, I've been playing around with running different userscripts and came across a small issue. The example in config.rst of a subcommand userscript: echo "some_data" > input.nml currently doesn't work.
I think this might be due to the default setting of shell=False used in the sp.check_call call in the run_userscript method though am not completely sure:
def run_userscript(self, script_cmd):
# First try to interpret the argument as a full command:
try:
sp.check_call(shlex.split(script_cmd))
I'm wondering whether it's preferable to update run_userscript to make commands like the example from config.rst possible, or instead to update config.rst to clarify the types of commands which can be run?
I think having shell=True would make it easier to provide arguments like environment variables and storage flags when running userscripts, but it still should be possible otherwise.
Following on from the discussion about exporting environment variables for use in userscripts, I've been playing around with running different userscripts and came across a small issue. The example in
config.rst
of a subcommand userscript:echo "some_data" > input.nml
currently doesn't work.Placing this in
config.yaml
ends up just printing "some_data > input.txt" to the output rather than writing to a file:
I think this might be due to the default setting of
shell=False
used in thesp.check_call
call in therun_userscript
method though am not completely sure:I'm wondering whether it's preferable to update
run_userscript
to make commands like the example fromconfig.rst
possible, or instead to updateconfig.rst
to clarify the types of commands which can be run?I think having
shell=True
would make it easier to provide arguments like environment variables and storage flags when running userscripts, but it still should be possible otherwise.