Implements check for required commands
This commit is contained in:
parent
cc3f536c62
commit
119c2eea58
9
main.go
9
main.go
@ -7,6 +7,7 @@ package main
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
|
||||
kingpin "gopkg.in/alecthomas/kingpin.v2"
|
||||
@ -57,6 +58,14 @@ func main() {
|
||||
kernelCommand := app.Command("kernel", "Manipulate kernels")
|
||||
kernelListCommand := kernelCommand.Command("list", "List kernels")
|
||||
|
||||
// Check for required commands
|
||||
for _, cmd := range []string{"timeout", "docker", "qemu"} {
|
||||
_, err := exec.Command("which", cmd).CombinedOutput()
|
||||
if err != nil {
|
||||
log.Fatalln("Command not found:", cmd)
|
||||
}
|
||||
}
|
||||
|
||||
kingpin.MustParse(app.Parse(os.Args[1:]))
|
||||
|
||||
kcfg, err := config.ReadKernelConfig(*kcfgPath)
|
||||
|
Loading…
Reference in New Issue
Block a user