Compare commits
2 Commits
bb3abfe3a7
...
9a9ccaf5f5
Author | SHA1 | Date | |
---|---|---|---|
9a9ccaf5f5 | |||
|
cc128b5b9d |
2
Makefile
2
Makefile
@ -3,7 +3,7 @@
|
|||||||
BIN_NAME := deploy
|
BIN_NAME := deploy
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -buildmode=pie -ldflags '-w -s' -o $(BIN_NAME) ./cmd/svc/main.go
|
CGO_ENABLED=0 go build -buildmode=pie -ldflags '-w -s' -o $(BIN_NAME) ./cmd/svc/main.go
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm $(BIN_NAME)
|
rm $(BIN_NAME)
|
||||||
|
@ -52,11 +52,16 @@ func (s *HTTPServer) setHandler(check map[string]string, script string) gin.Hand
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
nlog.Warnf("setup pipe out fail: %+v\n", err)
|
nlog.Warnf("setup pipe out fail: %+v\n", err)
|
||||||
}
|
}
|
||||||
|
errReader, err := cmd.StderrPipe()
|
||||||
|
if err != nil {
|
||||||
|
nlog.Warnf("setup pipe out fail: %+v\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
if err := cmd.Start(); err != nil {
|
if err := cmd.Start(); err != nil {
|
||||||
nlog.Warnf("start script fail: %+v\n", err)
|
nlog.Warnf("start script fail: %+v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
go func() {
|
||||||
in := bufio.NewScanner(reader)
|
in := bufio.NewScanner(reader)
|
||||||
for in.Scan() {
|
for in.Scan() {
|
||||||
nlog.Debugf(in.Text())
|
nlog.Debugf(in.Text())
|
||||||
@ -64,6 +69,16 @@ func (s *HTTPServer) setHandler(check map[string]string, script string) gin.Hand
|
|||||||
if err := in.Err(); err != nil {
|
if err := in.Err(); err != nil {
|
||||||
nlog.Warnf("script error: %+v\n", err)
|
nlog.Warnf("script error: %+v\n", err)
|
||||||
}
|
}
|
||||||
|
}()
|
||||||
|
go func() {
|
||||||
|
in := bufio.NewScanner(errReader)
|
||||||
|
for in.Scan() {
|
||||||
|
nlog.Debugf(in.Text())
|
||||||
|
}
|
||||||
|
if err := in.Err(); err != nil {
|
||||||
|
nlog.Warnf("script error: %+v\n", err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user