Skip to content

Commit

Permalink
Provided via cli executable is checked for being a directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
kuredoro committed Oct 16, 2021
1 parent dcc323a commit 7e27594
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmd/cptest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,17 @@ func main() {
return
}

execStat, err := os.Stat(execPath)
if err != nil {
fmt.Printf("error: read executable's properties: %v\n", err)
return
}

if execStat.IsDir() {
fmt.Printf("error: provided executable %s is a directory\n", args.Executable)
return
}

proc := &Executable{
Path: execPath,
Args: args.Args,
Expand Down

0 comments on commit 7e27594

Please sign in to comment.