Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 41e0165

Browse files
committed
make windows-specific stubs
1 parent 85d0635 commit 41e0165

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

agent/reaper/reaper_stub.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//go:build windows
2+
3+
package reaper
4+
5+
import "github.com/hashicorp/go-reap"
6+
7+
// IsChild returns true if we're the forked process.
8+
func IsChild() bool {
9+
return false
10+
}
11+
12+
// IsInitProcess returns true if the current process's PID is 1.
13+
func IsInitProcess() bool {
14+
return false
15+
}
16+
17+
func ForkReap(pids reap.PidCh) error {
18+
return nil
19+
}

agent/reaper/reaper_test.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
//go:build !windows
2+
13
package reaper_test
24

35
import (
46
"os/exec"
5-
"runtime"
67
"testing"
78
"time"
89

@@ -15,10 +16,6 @@ import (
1516
func TestReap(t *testing.T) {
1617
t.Parallel()
1718

18-
if runtime.GOOS != "linux" {
19-
t.Skipf("Skipping non-Linux OS %q", runtime.GOOS)
20-
}
21-
2219
// Because we're forkexecing these tests will try to run twice...
2320
if reaper.IsChild() {
2421
t.Skip("I'm a child!")

agent/reaper/reaper.go renamed to agent/reaper/reaper_unix.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//go:build !windows
2+
13
package reaper
24

35
import (

0 commit comments

Comments
 (0)