Web lists-archives.com

Re: Do test-path_is_{file,dir,exists} make sense anymore with -x?

On Tue, Feb 26, 2019 at 06:04:00PM +0100, SZEDER Gábor wrote:

> > Whereas:
> > 
> >     + test -f doesnotexist
> >     + echo File doesnotexist doesn't exist.
> >     File doesnotexist doesn't exist.
> >     + false
> >     error: last command exited with $?=1
> > 
> > Gives me the same thing, but I have to read 5 lines instead of 2 that
> > ultimately don't tell me any more (and a bit of "huh, 'false' returned
> > 1? Of course! Oh! It's faking things up and it's the 'echo' that
> > matters...").
> I didn't find this to be an issue, but because of functions like
> 'test_seq' and 'test_must_fail' I've thought about suppressing '-x'
> output for test helpers (haven't actually done anything about it,
> though).

I'd be curious how you'd do that. We can wrap the function and redirect
its stderr, but you'd still get a crufty line invoking the inner
function (plus the outer function). That's better than seeing the inner
details, but not as nice as just seeing the outer function invocation.

I don't think we can play games like the one we do in test_eval_(),
because "set -x" will already be on.