Skip to content

Commit

Permalink
Merge pull request #158 from ddspog/development
Browse files Browse the repository at this point in the history
dbtest: Use os.Kill on Windows instead of os.Interrupt
  • Loading branch information
domodwyer authored May 9, 2018
2 parents 9a3d363 + db3a6a9 commit a46ca38
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions dbtest/dbserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"net"
"os"
"os/exec"
"runtime"
"strconv"
"time"

Expand Down Expand Up @@ -70,7 +71,7 @@ func (dbs *DBServer) start() {
err = dbs.server.Start()
if err != nil {
// print error to facilitate troubleshooting as the panic will be caught in a panic handler
fmt.Fprintf(os.Stderr, "mongod failed to start: %v\n",err)
fmt.Fprintf(os.Stderr, "mongod failed to start: %v\n", err)
panic(err)
}
dbs.tomb.Go(dbs.monitor)
Expand Down Expand Up @@ -113,7 +114,12 @@ func (dbs *DBServer) Stop() {
}
if dbs.server != nil {
dbs.tomb.Kill(nil)
dbs.server.Process.Signal(os.Interrupt)
// Windows doesn't support Interrupt
if runtime.GOOS == "windows" {
dbs.server.Process.Signal(os.Kill)
} else {
dbs.server.Process.Signal(os.Interrupt)
}
select {
case <-dbs.tomb.Dead():
case <-time.After(5 * time.Second):
Expand Down

0 comments on commit a46ca38

Please sign in to comment.