Skip to content

Commit 18931cb

Browse files
committed
Do not hide the return code of context2csv.
The wrapper script for the `context2csv` command should return the same error code as the command itself. We can't do that by using `set -e`, because then any error in `context2csv` would cause the wrapper to immediately exit without removing the temporary file. And using `trap` to make sure the file is always removed regardless of how the script terminates could make the script less portable (I don't remember how well `trap` is supported in the various shells out there, and I can't be bothered to check right now). So we simply capture the return code of `context2csv`, remove the intermediate file, and explicitly exits the wrapper with the captured return code.
1 parent 8b9db1e commit 18931cb

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

scripts/compat-context2csv.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/sh
22
cat > $$.tmp
33
odk-helper context2csv $$.tmp
4+
rc=$?
45
rm $$.tmp
6+
exit $rc

0 commit comments

Comments
 (0)