Skip to content

Commit

Permalink
cmd: fix regression for stdin/stdout, fixes #392
Browse files Browse the repository at this point in the history
  • Loading branch information
tdewolff committed Mar 17, 2021
1 parent bf673be commit e061c21
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cmd/minify/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -683,12 +683,6 @@ func minify(t Task) bool {
}
}

srcInfo, err := os.Stat(t.srcs[0])
if err != nil {
Error.Println(err)
return false
}

fileMimetype := mimetype
if mimetype == "" && !t.sync {
for _, src := range t.srcs {
Expand Down Expand Up @@ -753,7 +747,14 @@ func minify(t Task) bool {
return false
}

os.Chmod(t.dst, srcInfo.Mode().Perm())
if t.srcs[0] != "" {
srcInfo, err := os.Stat(t.srcs[0])
if err != nil {
Error.Println(err)
return false
}
os.Chmod(t.dst, srcInfo.Mode().Perm())
}

// synchronize file
if t.sync {
Expand Down

0 comments on commit e061c21

Please sign in to comment.