Project

General

Profile

Actions

Bug #20730

closed

LoadError if Rakefile has shebang

Added by watson1978 (Shizuo Fujita) 2 months ago. Updated 2 months ago.

Status:
Closed
Assignee:
-
Target version:
ruby -v:
ruby 3.4.0dev (2024-09-12T20:03:28Z master 0fc8422a05) +PRISM [x86_64-linux]
[ruby-dev:<unknown>]

Description

LoadError exception will be raised when invoke the rake task with latest ruby 3.4-dev.

Reproduce code

Here is example code.

#!/usr/bin/env rake

p "Hello"

Result

$ ruby -v
ruby 3.4.0dev (2024-09-12T20:03:28Z master 0fc8422a05) +PRISM [x86_64-linux]

$ rake -f test.rake
rake aborted!
LoadError: no Ruby script found in input (LoadError)

(See full trace by running task with --trace)
Actions #1

Updated by kddnewton (Kevin Newton) 2 months ago

I have opened https://github.com/ruby/ruby/pull/11617 to fix this.

Actions #2

Updated by kddnewton (Kevin Newton) 2 months ago

  • Status changed from Open to Closed

Applied in changeset git|9afc6a981deae6e23d938cf5c2c4baadfeaafdb1.


[PRISM] Only parse shebang on main script

Fixes [Bug #20730]

Actions #3

Updated by nobu (Nobuyoshi Nakada) 2 months ago

ruby command handles a shebang, but it is not a part of the Ruby syntax.
Parsers should not consider shebang lines.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0