diff --git a/pkg/transpile/puzzle.go b/pkg/transpile/puzzle.go index 77a9ed1..4d9c512 100644 --- a/pkg/transpile/puzzle.go +++ b/pkg/transpile/puzzle.go @@ -11,6 +11,7 @@ import ( "io" "log" "net/mail" + "os" "os/exec" "path" "strconv" @@ -140,16 +141,20 @@ type PuzzleProvider interface { func NewFsPuzzle(fs afero.Fs) PuzzleProvider { var command string - if info, err := fs.Stat("mkpuzzle"); (err == nil) && (info.Mode()&0100 != 0) { - // Try to get the actual path to the executable - if pfs, ok := fs.(*RecursiveBasePathFs); ok { - if command, err = pfs.RealPath(info.Name()); err != nil { - log.Println("Unable to resolve full path to", info.Name(), pfs) - } - } else if pfs, ok := fs.(*afero.BasePathFs); ok { - if command, err = pfs.RealPath(info.Name()); err != nil { - log.Println("Unable to resolve full path to", info.Name(), pfs) + if info, err := fs.Stat("mkpuzzle"); !os.IsNotExist(err) { + if (info.Mode() & 0100) != 0 { + // Try to get the actual path to the executable + if pfs, ok := fs.(*RecursiveBasePathFs); ok { + if command, err = pfs.RealPath(info.Name()); err != nil { + log.Println("WARN: Unable to resolve full path to", info.Name(), pfs) + } + } else if pfs, ok := fs.(*afero.BasePathFs); ok { + if command, err = pfs.RealPath(info.Name()); err != nil { + log.Println("WARN: Unable to resolve full path to", info.Name(), pfs) + } } + } else { + log.Println("WARN: mkpuzzle exists, but isn't executable.") } }