nufeb / NUFEB

Official release of the NUFEB software
http://research.ncl.ac.uk/nufeb/
GNU General Public License v3.0
18 stars 16 forks source link

Shell scripts should exit immediately on error #13

Closed joeweaver closed 3 years ago

joeweaver commented 3 years ago

Right now the install script (and others) will chug merrily along even if an error occurs.

Partially to fix this small issue and partially to get used to the collaboration workflow, I've fixed this up in the main install/uninstall scripts. Haven't touched the scripts in the examples or those which are rightly the responsibility of LAMMPS or other third parties.

Fix is to add:

  1. set -euo pipefail right after the shebang
  2. convert cd <target> commands to cd <target> || exit 1

Supporting docs:

  1. https://sipb.mit.edu/doc/safe-shell/**
  2. https://github.com/koalaman/shellcheck/wiki/SC2164

Probably a good idea to open an issue on scripts passing/failing shellcheck, too. If only to document any wontfix reasoning. Maybe look into a git hook.

joeweaver commented 3 years ago

PR #14 should fix

joeweaver commented 3 years ago

PR was merged, closing.