guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shepherd] 01/01: service: Don't raise error when stopping an alread


From: Ludovic Courtès
Subject: Re: [shepherd] 01/01: service: Don't raise error when stopping an already stopped service.
Date: Tue, 05 Feb 2019 22:24:22 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux)

Hello!

address@hidden (Ricardo Wurmus) skribis:

> +# Stopping a stopped service should be a no-op.
> +out=$($herd stop test)
> +test $?
> +test -z "$out"

A really minor issue, but I’d suggest writing it like this:

  $herd stop test
  out="`$herd stop test`"
  test -z "$out"

The reasoning is that (1) it’s running under “set -e” so a failure of
“herd stop” would stop the whole script anyway, (2) we try to avoid
Bash-specific constructs in this file, hence backticks, and (3) always
enclose command outputs in double quotes.

(I can’t believe I’m arguing on shell scripts, remnants of a previous
life I guess…)

Thank you,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]