dartsass: Improve error message when no read access
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 15 Mar 2022 07:54:56 +0000 (08:54 +0100)
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
Tue, 15 Mar 2022 15:34:54 +0000 (16:34 +0100)
Fixes #9662

resources/resource_transformers/tocss/dartsass/client.go

index c2a572d9bb56bdcfbbb1827e1a3206d637b21ae5..b5d05b30b41455dece20450b17eec11d80763cb9 100644 (file)
@@ -16,6 +16,7 @@
 package dartsass
 
 import (
+       "fmt"
        "io"
 
        "github.com/gohugoio/hugo/helpers"
@@ -77,6 +78,9 @@ func (c *Client) toCSS(args godartsass.Args, src io.Reader) (godartsass.Result,
 
        res, err := c.transpiler.Execute(args)
        if err != nil {
+               if err.Error() == "unexpected EOF" {
+                       return res, fmt.Errorf("got unexpected EOF when executing %q. The user running hugo must have read and execute permissions on this program. With execute permissions only, this error is thrown.", dartSassEmbeddedBinaryName)
+               }
                return res, err
        }