1
0
mirror of https://github.com/securego/gosec.git synced 2025-07-09 00:45:40 +02:00

add CommandContext as subprocess launcher

This commit is contained in:
Will Roden
2018-06-03 16:43:28 -05:00
parent 4ae8c95b40
commit d7ec2fce7a
2 changed files with 15 additions and 0 deletions

View File

@ -408,6 +408,20 @@ func main() {
log.Printf("Command finished with error: %v", err)
}`, 1}, {`
package main
import (
"log"
"os/exec"
"context"
)
func main() {
err := exec.CommandContext(context.Background(), "sleep", "5").Run()
if err != nil {
log.Fatal(err)
}
log.Printf("Command finished with error: %v", err)
}
}`, 1}, {`
package main
import (
"log"
"os"