-
Notifications
You must be signed in to change notification settings - Fork 6
/
osutil_windows.go
45 lines (37 loc) · 1 KB
/
osutil_windows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// Copyright 2013 Chris McGee <[email protected]>. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// +build windows
package gdblib
import (
"go/build"
"os"
"os/exec"
"path/filepath"
"strings"
)
var (
sendSignalPath string
)
func init() {
gopath := build.Default.GOPATH
gopaths := strings.Split(gopath, string(filepath.ListSeparator))
for _, path := range gopaths {
p := path + "\\src\\github.com\\sirnewton01\\gdblib\\SendSignal.exe"
_, err := os.Stat(p)
if err == nil {
sendSignalPath = p
break
}
}
}
func fixCmd(cmd *exec.Cmd) {
// No process group separation is required on Windows.
// Processes do not share signals like they can on Unix.
}
func interruptInferior(process *os.Process, pid string) {
// Invoke the included "sendsignal" program to send the
// Ctrl-break to the inferior process to interrupt it
initCommand := exec.Command("cmd", "/c", "start", sendSignalPath, pid)
initCommand.Run()
}