diff options
| author | ewy <ewy0@protonmail.com> | 2026-07-11 16:48:26 +0200 |
|---|---|---|
| committer | ewy <ewy0@protonmail.com> | 2026-07-11 16:48:26 +0200 |
| commit | 8310dce819bdced22f777c8ce7b403c5dd014ec2 (patch) | |
| tree | 034095746c326c7390e96800c4f8bca14d74a8d7 | |
| parent | 21d3b8d71549cd4a4ef21c58e3780082228c8bcd (diff) | |
fixed...
| -rw-r--r-- | runner/shell/shell.go | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/runner/shell/shell.go b/runner/shell/shell.go index 39fdf79..f696a46 100644 --- a/runner/shell/shell.go +++ b/runner/shell/shell.go @@ -110,8 +110,6 @@ func (s *shell) CreateTarget(fs fs.FS, src string, file string, _ fs.DirEntry) ( func (s *shell) ShellFor(fs fs.FS, file string) (string, error) { - var shell, shebang string - // low-hanging fruit - indicative filename if byFile := s.ShellByFilename(file); byFile != "" { return byFile, nil @@ -126,21 +124,21 @@ func (s *shell) ShellFor(fs fs.FS, file string) (string, error) { if !scanner.Scan() { return "", NoContentError } - txt := scanner.Text() - if strings.HasPrefix(txt, "#!") { + firstLine := scanner.Text() + if strings.HasPrefix(firstLine, "#!") { // shebang found - byShebang := s.ShellByShebang(txt) + byShebang := s.ShellByShebang(firstLine) if byShebang != "" { return byShebang, nil } else { - _, _ = spool.Warn("script has %s but could not find %s\n", shebang) + _, _ = spool.Warn("script has %s but could not find %s\n", firstLine) } } // if no shebang, just send the first one we find for _, s := range Shells { if p, err := exec.LookPath(s); err != nil { - shell = p + return p, nil } } |
