Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

an ambigous error message when the interpreter not found #209

Open
oprogramador opened this issue Jun 26, 2020 · 3 comments
Open

an ambigous error message when the interpreter not found #209

oprogramador opened this issue Jun 26, 2020 · 3 comments

Comments

@oprogramador
Copy link

/app # /usr/local/bin/dumb-init -- /app/watch.sh
[dumb-init] /app/watch.sh: No such file or directory
/app # /usr/local/bin/dumb-init /app/watch.sh
[dumb-init] /app/watch.sh: No such file or directory
/app #
/app # cat /app/watch.sh
#!/usr/local/bin/bash

while true
do
  time ./runner
  sleep 120
done
/app #
@oprogramador
Copy link
Author

oprogramador commented Jun 26, 2020

It works after replacing #!/usr/local/bin/bash to #!/bin/sh.

So IMO dumb-init should have an error message improved to something like that:

[dumb-init] /app/watch.sh: /usr/local/bin/bash: No such file or directory

@oprogramador oprogramador changed the title dumb-init cannot find an existent file an ambigous error message when the interpreter not found Jun 26, 2020
@oprogramador
Copy link
Author

oprogramador commented Jun 26, 2020

The same error message is displayed when a file to run isn't found:

/app # /usr/local/bin/dumb-init foobarbaz
[dumb-init] foobarbaz: No such file or directory
/app # cat foobarbaz
cat: can't open 'foobarbaz': No such file or directory

@asottile
Copy link
Contributor

this is the message that's handed from the OS, we have no control over it

compare with what python sees:

>>> subprocess.call(('./t',))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: './t'
>>> subprocess.call(('does-not-exist',))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.8/subprocess.py", line 340, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'does-not-exist'

(./t is set up in the same way as your executable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants