diff options
| author | ewy <ewy0@protonmail.com> | 2026-11-21 15:31:02 +0100 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-11-21 15:31:02 +0100 |
| commit | 9f023f5cd9188c343d3b015f3439b34dea715b6a (patch) | |
| tree | ab8f4b6f1ea879983393bdb039d2a4c126a57c17 /runner/shell | |
| parent | 033bd9d11dd1b9b3fe9171b07747611ee0068af5 (diff) | |
warning message for scripts without shebang
Diffstat (limited to 'runner/shell')
| -rw-r--r-- | runner/shell/shell.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/runner/shell/shell.go b/runner/shell/shell.go index f696a46..6c9a1ed 100644 --- a/runner/shell/shell.go +++ b/runner/shell/shell.go @@ -23,6 +23,7 @@ var NoShellError = errors.New("could not find any shell interpreters") var ExtShellMap = map[string]string{ ".bash": "bash", + ".zsh": "zsh", ".fish": "fish", ".ps1": "powershell", ".bat": "cmd", @@ -39,6 +40,8 @@ type shell struct { Locations map[string]string } +var AmbiguousScriptError = errors.New("ambiguous script without shebang\nadd first line #!/usr/bin/env bash") + func (s *shell) Wants(f fs.FS, file string, entry fs.DirEntry) (bool, error) { if entry != nil && entry.IsDir() { return false, nil @@ -62,6 +65,9 @@ func (s *shell) Wants(f fs.FS, file string, entry fs.DirEntry) (bool, error) { return true, nil } } + if filepath.Ext(file) == ".sh" { + return true, AmbiguousScriptError + } return false, nil } |
