sphuber / aiida-shell

AiiDA plugin that makes running shell commands easy.
MIT License
14 stars 7 forks source link

`launch_shell_job`: Only `which` command if code doesn't already exist #39

Closed sphuber closed 1 year ago

sphuber commented 1 year ago

The prepare_code function was calling which on the specified command before it checked whether the associated code already existed. This means that it would raise if which fails to detect the absolute path, even if the user pre-created a Code instance for the command manually in advance to circumvent this problem.

The check is now moved to the except block in case the code doesn't exist. It is only then that a code needs to be created and so only then that it makes sense to perform the check on the provided command.