We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3fb133e commit db56873Copy full SHA for db56873
portmapper/proxy.go
@@ -7,6 +7,7 @@ import (
7
"net"
8
"os"
9
"os/exec"
10
+ "syscall"
11
"time"
12
13
"github.com/ishidawataru/sctp"
@@ -65,10 +66,23 @@ func (p *proxyCommand) Start() error {
65
66
67
func (p *proxyCommand) Stop() error {
68
if p.cmd.Process != nil {
- if err := p.cmd.Process.Signal(os.Interrupt); err != nil {
69
+ if err := p.cmd.Process.Signal(syscall.SIGTERM); err != nil {
70
return err
71
}
- return p.cmd.Wait()
72
+
73
+ waitChan := make(chan error)
74
+ go func() {
75
+ waitChan <- p.cmd.Wait()
76
+ }()
77
78
+ select {
79
+ case result := <-waitChan:
80
+ return result
81
+ case <-time.After(15 * time.Second):
82
+ if err := p.cmd.Process.Signal(os.Kill); err != nil {
83
+ return err
84
+ }
85
86
87
return nil
88
0 commit comments