Cmd prints stdout and sterr
This commit is contained in:
parent
b5182bfb9c
commit
fffbad8a44
@ -2,7 +2,7 @@
|
|||||||
project_name: "don"
|
project_name: "don"
|
||||||
|
|
||||||
gitea_urls:
|
gitea_urls:
|
||||||
api: https://git.xsfx.dev/api/v1
|
api: https://git.xsfx.dev/api/v1/
|
||||||
|
|
||||||
builds:
|
builds:
|
||||||
- main: ./cmd
|
- main: ./cmd
|
||||||
|
4
don.go
4
don.go
@ -5,6 +5,7 @@ package don
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@ -18,6 +19,9 @@ var errTimeout = errors.New("timeout")
|
|||||||
func Cmd(c string) func() bool {
|
func Cmd(c string) func() bool {
|
||||||
return func() bool {
|
return func() bool {
|
||||||
cmd := exec.Command("sh", "-c", c)
|
cmd := exec.Command("sh", "-c", c)
|
||||||
|
cmd.Stdout = os.Stdout
|
||||||
|
cmd.Stderr = os.Stderr
|
||||||
|
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
log.Warn().Err(err).Msg("cmd has error")
|
log.Warn().Err(err).Msg("cmd has error")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user