Project

General

Profile

Actions

Feature #16952

open

Kernel.exec gives an incorrect error message when passed a script with a non-existing shebang

Added by deivid (David Rodríguez) over 4 years ago. Updated over 4 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:98744]

Description

$ cat myscript.rb 
#!/bad/ruby/shebang

puts "Hei!"

$ ruby -e 'Kernel.exec("myscript.rb")'

Traceback (most recent call last):
	1: from -e:1:in `<main>'
-e:1:in `exec': No such file or directory - myscript.rb (Errno::ENOENT)

From the error, I understand that the script is not there, but the script is clearly there.

I would've expected something more similar to what you get if you try to run the script directly from the shell:

$ ./myscript.rb 
bash: ./myscript.rb: /bad/ruby/shebang: bad interpreter: No such file or directory
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0