bug-gnulib
[Top][All Lists]
Advanced

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

gnulib-tool.py: Fix behavior of --test when a subprocess fails.


From: Collin Funk
Subject: gnulib-tool.py: Fix behavior of --test when a subprocess fails.
Date: Wed, 8 May 2024 01:33:44 -0700
User-agent: Mozilla Thunderbird

On 5/8/24 12:47 AM, Collin Funk wrote:
>> With .sh, both fail. With .py, both succeed. Looks like a bug in
>> gnulib-tool.py: When the 'make' or 'make check' step fails, the entire
>> command should fail.
>
> I see what you mean. I'll have a look at fixing that right now.

I've pushed the attached patch. In gnulib-tool.sh the following is
done:

    ../configure || func_exit 1
    $MAKE || func_exit 1
    [...]

So here we can just use sp.run([command, arg], check=True) and exit if
an exception occurs.

As a side note, gradually I'll start changing sp.call(),
sp.check_call(), etc. to sp.run(). Under the hood they all call the
same internal functions, but the latter is newer and "recommended"
[1].

I always forget how that module works and just using the recommended
sp.run() makes scanning the documentation easier.

[1] 
https://docs.python.org/3/library/subprocess.html#using-the-subprocess-module

Collin

Attachment: 0001-gnulib-tool.py-Fix-behavior-of-test-when-a-subproces.patch
Description: Text Data


reply via email to

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