From 8310dce819bdced22f777c8ce7b403c5dd014ec2 Mon Sep 17 00:00:00 2001 From: ewy Date: Sat, 11 Jul 2026 16:48:26 +0200 Subject: fixed... --- runner/shell/shell.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'runner/shell') 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 } } -- cgit v1.3.1