cruise-automation / daytona

A Vault client, but for containers and servers.
Apache License 2.0
310 stars 33 forks source link

Panic when -entrypoint passed without args #21

Closed ryboe closed 5 years ago

ryboe commented 5 years ago
DAYTONA - 2019/08/27 19:46:11 Will exec:  []
panic: runtime error: index out of range

goroutine 1 [running]:
main.main()
    /go/src/github.robot.car/cruise/gulp/vendor/github.com/cruise-automation/daytona/cmd/daytona/main.go:181 +0xc03

Here's the panicking code in main.go.

if config.Entrypoint {
    args := flag.Args()
    log.Println("Will exec: ", args)
    binary, err := exec.LookPath(args[0]) // <<<< panic is here. args list is empty
    if err != nil {
        log.Fatalf("Error finding '%s' to exec: %s\n", args[0], err)
    }
    err = syscall.Exec(binary, args, os.Environ())
    if err != nil {
        log.Fatalf("Error from exec: %s\n", err)
    }
}