exec: fichier exécutable ne trouve pas dans $PATH

J'essaie d'envoyer le signal HUP tor en Aller.

    command := exec.Command("pidof tor | xargs kill -HUP")
    command.Dir = "/bin"

    if cmdOut, err := command.CombinedOutput(); err != nil {
        log.Panic("There was an error running HUP ", string(cmdOut), err)
        panic(err)
    }

J'ai essayé de nombreuses version de ce (avec/hors args, avec la Dir, ...) et on en revient toujours avec le même message d'erreur:

2017/06/27 13:36:31 There was an error running HUP exec: "pidof tor | xargs kill -HUP": executable file not found in $PATH
panic: There was an error running HUP exec: "pidof tor | xargs kill -HUP": executable file not found in $PATH

goroutine 1 [running]:
panic(0x639ac0, 0xc42000d260)
        /usr/local/go/src/runtime/panic.go:500 +0x1a1
log.Panic(0xc420049f08, 0x3, 0x3)
        /usr/local/go/src/log/log.go:320 +0xc9
main.main()

L'exécution de la commande à partir de la console fonctionne parfaitement:

root@c8927c4a456e:/go/src/github.com/project# pidof tor | xargs kill -HUP
Jun 27 13:40:07.000 [notice] Received reload signal (hup). Reloading config and resetting internal state.
Jun 27 13:40:07.000 [notice] Read configuration file "/etc/tor/torrc".

Voici mon $PATH

root@c8927c4a456e:/go/src/github.com/project# echo $PATH
/go/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Je l'ai fait précédemment avec la commande git et il a été de travailler en toute transparence. Ai-je raté quelque chose ?

InformationsquelleAutor Mathieu Nls | 2017-06-27