mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-12 21:10:37 +00:00
Add shebang support (#149)
Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
This commit is contained in:
parent
2e6a2090c3
commit
12ef94df5e
1 changed files with 4 additions and 0 deletions
|
@ -67,6 +67,10 @@ std::optional<std::string> readFile(const std::string& name)
|
|||
if (read != size_t(length))
|
||||
return std::nullopt;
|
||||
|
||||
// Skip first line if it's a shebang
|
||||
if (length > 2 && result[0] == '#' && result[1] == '!')
|
||||
result.erase(0, result.find('\n'));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue