Skip to content

Commit

Permalink
Exit if we can't open a file given as argument
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdan committed Jun 20, 2015
1 parent fda87db commit 548f477
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/xurls/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func main() {
var err error
if re, err = xurls.StrictMatching(*matching); err != nil {
fmt.Fprintf(os.Stderr, "invalid regular expression '%s': %v\n", *matching, err)
os.Exit(2)
os.Exit(1)
}
}
args := flag.Args()
Expand All @@ -68,6 +68,7 @@ func main() {
file, err := os.Open(path)
if err != nil {
fmt.Fprintf(os.Stdout, "could not open file '%s': %v\n", path, err)
os.Exit(1)
}
scan(re, file)
file.Close()
Expand Down

0 comments on commit 548f477

Please sign in to comment.