# Use of set -euo pipefail in Cylc generated job script

**URL:** <https://cylc.discourse.group/t/use-of-set-euo-pipefail-in-cylc-generated-job-script/613>\
**Category:** Cylc Support\
**Created:** [March 23, 2023, 1:31am UTC](https://cylc.discourse.group/t/use-of-set-euo-pipefail-in-cylc-generated-job-script/613 "2023-03-23T01:31:24Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![dpmatthews](https://yyz2.discourse-cdn.com/free1/user_avatar/cylc.discourse.group/dpmatthews/32/26_2.png) [@dpmatthews](https://cylc.discourse.group/u/dpmatthews)\
**Post date:** [March 27, 2023, 2:08pm UTC](https://cylc.discourse.group/t/use-of-set-euo-pipefail-in-cylc-generated-job-script/613/21 "2023-03-27T14:08:57Z")

</div>

> [@TomC](#):
>
> One issue I have is that there will be potential inconsistent behaviour if someone runs a script via Cylc versus without Cylc.

If you run a script via Cylc versus without Cylc there is no problem.  
If you define some commands for Cylc to run in the job script (via `script`, `pre-script`, etc) and then you cut and paste those commands into a standalone script then, yes, you need to be careful.

> [@TomC](#):
>
> I also take issue with Cylc not being defensive and protecting itself against people doing `set +euo pipefail`, which is well within the rights of anyone to do. A simple change like I [described earlier](https://cylc.discourse.group/t/use-of-set-euo-pipefail-in-cylc-generated-job-script/613/16) would add some safety to Cylc.

I don’t really see how this adds any safety.  
If I understand things correctly, with Cylc 7 if you define `set +e` (say in `env-script`) then any subsequent commands that fail (non-zero return code) do not cause the job to fail **unless** they happen to be the last command in that section of the script definition. That makes no sense to me - why should a failure of the last command in, e.g. the `pre-script` be significant? I think the Cylc 8 behaviour makes more sense - if you define `set +e` then ignore all command failures (you are taking responsibility for error handling).

[Previous page](https://cylc.discourse.group/t/use-of-set-euo-pipefail-in-cylc-generated-job-script/613.md?page=1)
