diff mbox series

devtool: provide explicit error for missing "script" command

Message ID 20260613-script-command-not-found-v1-1-5c5f6742a6fa@schnwalter.eu
State New
Headers show
Series devtool: provide explicit error for missing "script" command | expand

Commit Message

Walter Werner Schneider June 13, 2026, 12:11 p.m. UTC
Without this "script" command, the "devtool build" provides a very
ambigous error: `/bin/sh: line 1: script: command not found`. With this
patch we provide a more detailed error.

On Fedora 43 the "script" command is not present by default, one needs
to install the "util-linux-script" package. On other systems it's in a
different package.

Signed-off-by: Walter Werner Schneider <contact@schnwalter.eu>
---
 scripts/lib/devtool/__init__.py | 3 +++
 1 file changed, 3 insertions(+)


---
base-commit: dcaea329458c741f47560d51732e3d9c88f3d5b4
change-id: 20260613-script-command-not-found-14e1a3be7410

Best regards,
diff mbox series

Patch

diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py
index f47f57c465..58b02eb460 100644
--- a/scripts/lib/devtool/__init__.py
+++ b/scripts/lib/devtool/__init__.py
@@ -42,6 +42,9 @@  def exec_build_env_command(init_path, builddir, cmd, watch=False, **options):
         init_prefix = ''
     if watch:
         if sys.stdout.isatty():
+            import shutil
+            if not shutil.which('script'):
+                raise DevtoolError('The util-linux "script" command was not found')
             # Fool bitbake into thinking it's outputting to a terminal (because it is, indirectly)
             cmd = 'script -e -q -c "%s" /dev/null' % cmd
         return exec_watch('%s%s' % (init_prefix, cmd), **options)