Skip to content

Commit 581bc83

Browse files
author
bsnux
committed
Executing external command without reading output
1 parent dbeb94e commit 581bc83

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

exec-no-output/main.go

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
package main
2+
3+
import (
4+
"log"
5+
"os/exec"
6+
)
7+
8+
func main() {
9+
cmd := exec.Command("sleep", "10")
10+
log.Printf("Running command and waiting for it to finish...")
11+
err := cmd.Run()
12+
if err != nil {
13+
log.Printf("Command finished with error: %v", err)
14+
}
15+
log.Printf("Done!")
16+
}

0 commit comments

Comments
 (0)