gnulib-tool.py: Fix behavior of --test when a subprocess fails.
authorCollin Funk <collin.funk1@gmail.com>
Wed, 8 May 2024 08:24:09 +0000 (01:24 -0700)
committerCollin Funk <collin.funk1@gmail.com>
Wed, 8 May 2024 08:24:09 +0000 (01:24 -0700)
Reported by Bruno Haible in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00101.html>.

* pygnulib/main.py (main): Use sp.run with check=True so that an
exception is thrown when a process fails. Simply exit if an exception
occurs.

ChangeLog
pygnulib/main.py

index 41a8ef7eb637f040b6bad336347a0cd015ffa883..6d74b450bc5033f228550be3ba3a6a205d7776d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2024-05-08  Collin Funk  <collin.funk1@gmail.com>
+
+       gnulib-tool.py: Fix behavior of --test when a subprocess fails.
+       Reported by Bruno Haible in
+       <https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00101.html>.
+       * pygnulib/main.py (main): Use sp.run with check=True so that an
+       exception is thrown when a process fails. Simply exit if an exception
+       occurs.
+
 2024-05-07  Collin Funk  <collin.funk1@gmail.com>
 
        base32, base64: Prefer stdckdint to intprops.
index 6e29374af2fbface129d68672cae17511633771b..128f25f9c1e5df8537224a0e823dba70db735f18 100644 (file)
@@ -1098,10 +1098,10 @@ def main(temp_directory: str) -> None:
         os.mkdir('build')
         os.chdir('build')
         try:  # Try to execute commands
-            sp.call(['../configure'])
-            sp.call([UTILS['make']])
-            sp.call([UTILS['make'], 'check'])
-            sp.call([UTILS['make'], 'distclean'])
+            sp.run(['../configure'], check=True)
+            sp.run([UTILS['make']], check=True)
+            sp.run([UTILS['make'], 'check'], check=True)
+            sp.run([UTILS['make'], 'distclean'], check=True)
         except Exception:
             sys.exit(1)
         args = ['find', '.', '-type', 'f', '-print']