Skip to content

Commit a46ca38

Browse files
authored
Merge pull request #158 from ddspog/development
dbtest: Use os.Kill on Windows instead of os.Interrupt
2 parents 9a3d363 + db3a6a9 commit a46ca38

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

dbtest/dbserver.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"net"
77
"os"
88
"os/exec"
9+
"runtime"
910
"strconv"
1011
"time"
1112

@@ -70,7 +71,7 @@ func (dbs *DBServer) start() {
7071
err = dbs.server.Start()
7172
if err != nil {
7273
// print error to facilitate troubleshooting as the panic will be caught in a panic handler
73-
fmt.Fprintf(os.Stderr, "mongod failed to start: %v\n",err)
74+
fmt.Fprintf(os.Stderr, "mongod failed to start: %v\n", err)
7475
panic(err)
7576
}
7677
dbs.tomb.Go(dbs.monitor)
@@ -113,7 +114,12 @@ func (dbs *DBServer) Stop() {
113114
}
114115
if dbs.server != nil {
115116
dbs.tomb.Kill(nil)
116-
dbs.server.Process.Signal(os.Interrupt)
117+
// Windows doesn't support Interrupt
118+
if runtime.GOOS == "windows" {
119+
dbs.server.Process.Signal(os.Kill)
120+
} else {
121+
dbs.server.Process.Signal(os.Interrupt)
122+
}
117123
select {
118124
case <-dbs.tomb.Dead():
119125
case <-time.After(5 * time.Second):

0 commit comments

Comments
 (0)