Re: [PATCH 2/5] ci/lib: allow running in GitHub Actions
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Apr 12, 2020, 21:42 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2004122339290.46@tvgsbejvaqbjf.bet>
- In-Reply-To
- <xmqq7dynjgx7.fsf@gitster.c.googlers.com>
Hi,
On Fri, 10 Apr 2020, Junio C Hamano wrote:
Show 18 quoted lines
> SZEDER Gábor <szeder.dev@gmail.com> writes: > > >> > CI_OS_NAME=osx. This is head-scratchingly backwards, and I think > >> > > >> > test "$CI_OS_NAME" = macos && CI_OS_NAME=osx > >> > > >> > would read better. > >> > >> I can understand where you come from, but your code is not `set -e` safe, > > > > It works as expected in at least in dash, Bash, BusyBox sh, ksh, > > ksh93, mksh/lksh, yash, posh, FreeBSD /bin/sh, NetBSD /bin/sh. > > Thanks for a clarification. I do not use "set -e" myself (it is not > a good idea to rely on it in general), and was wondering if what was > said up there was true, as it did not sound like a useful behaviour > at all. Not complaining about a non-zero exit before && or || makes > it usable ;-)
While it is not in general useful to rely on `set -e`, there are situations when it comes in handy for debugging. Or in copy-edited code.
As to the "It works as expected", this is in a Bash:
$ test "$CI_OS_NAME" = macos && CI_OS_NAME=osx
$ echo $? 1
Yes, it works, but in the common case, it exits with an error (that we ignore, unless run with `sh -e ...`).
Just making sure that we're talking about the same expectation here.
Ciao, Dscho