Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbtest: Use os.Kill on Windows instead of os.Interrupt #158

Merged
merged 1 commit into from
May 9, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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