Gentoo Archives: gentoo-dev

From: Florian Schmaus <flow@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: [PATCH 1/1] edo.eclass: add new eclass
Date: Sat, 16 Apr 2022 10:23:37
Message-Id: 72567d06-8788-4b64-1863-09a6bfa6e55a@gentoo.org
In Reply to: [gentoo-dev] Re: [PATCH 1/1] edo.eclass: add new eclass by Ulrich Mueller
1 On 16/04/2022 10.38, Ulrich Mueller wrote:
2 >>>>>> On Sat, 16 Apr 2022, Sam James wrote:
3 >
4 >> +# @FUNCTION: edo
5 >
6 > Just a remark: A similar command existed a long time ago under the
7 > name "try". [1]
8 >
9 > It was executed under "env" [2], should we also do that?
10 >
11 >> +# @USAGE: command [arg1 [arg2 ...]]
12 >
13 > <command> should be in angle brackets, if we follow the usual
14 > convention. Maybe even "<command> [arg]..."
15 >
16 >> +# @DESCRIPTION:
17 >> +# Executes 'command' with any given arguments and exits on failure unless
18 >> +# called under 'nonfatal'.
19 >> +edo() {
20 >> + elog "$@"
21 >> + "$@" || die -n "Failed to run command: $@ failed"
22 >> +}
23 >
24 > Maybe add an ebegin/eend variant?
25
26 +1
27
28 > edobe() {
29
30 nit: I'd personally would use 'edob', as shorter is sometimes better
31 plus every begin needs an end, so no need to explicitly state that there
32 is an end.
33
34 > ebegin "Running $@"
35 > "$@"
36 > eend $? || die -n "$@ failed" > return $?
37
38 I think this return statement can be omitted since it will always be
39 invoked with 0 as argument, and this is the default behavior of implicit
40 function return (IIRC).
41
42 - Flow

Replies