File tree 3 files changed +14
-1
lines changed 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change 7
7
go.mod
8
8
tower-app- *
9
9
.DS_Store
10
- /process /process
10
+ /test / process /process
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ func main() {
25
25
input , _ := in .ReadString (com .LF )
26
26
if input == com .StrLF || input == com .StrCRLF {
27
27
color .Green (`[process] restart ==> ` + com .NowStr ())
28
+ //panic(`[panic]`)
28
29
} else {
29
30
color .Blue (`[process] waiting ==> ` + com .NowStr ())
30
31
}
Original file line number Diff line number Diff line change 1
1
package main
2
2
3
3
import (
4
+ "errors"
5
+ "log"
6
+ "os"
4
7
"time"
5
8
6
9
"github.com/webx-top/com"
@@ -9,9 +12,18 @@ import (
9
12
func main () {
10
13
ch := com .NewCmdChanReader ()
11
14
cmd := com .RunCmdWithReaderWriter ([]string {`../process` }, ch )
15
+ i := 0
12
16
for {
13
17
ch .Send (com .BreakLine )
14
18
time .Sleep (5 * time .Second )
19
+ i ++
20
+ if i >= 3 {
21
+ err := cmd .Process .Kill ()
22
+ if err != nil && ! errors .Is (err , os .ErrProcessDone ) {
23
+ log .Println (err )
24
+ }
25
+ break
26
+ }
15
27
}
16
28
_ = cmd
17
29
}
You can’t perform that action at this time.
0 commit comments