summaryrefslogtreecommitdiff
path: root/runner/shell
diff options
context:
space:
mode:
Diffstat (limited to 'runner/shell')
-rw-r--r--runner/shell/shell.go6
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
}