-
Notifications
You must be signed in to change notification settings - Fork 674
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tmpnet] Ensure tmpnet compatibility with windows
This avoids breaking unit test discovery for any package that imports tmpnet.
- Loading branch information
Showing
4 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
//go:build linux || darwin | ||
|
||
package tmpnet | ||
|
||
import ( | ||
"os/exec" | ||
"syscall" | ||
) | ||
|
||
func configureDetachedProcess(cmd *exec.Cmd) { | ||
cmd.SysProcAttr = &syscall.SysProcAttr{ | ||
Setsid: true, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (C) 2019-2024, Ava Labs, Inc. All rights reserved. | ||
// See the file LICENSE for licensing terms. | ||
|
||
//go:build windows | ||
|
||
package tmpnet | ||
|
||
import ( | ||
"os/exec" | ||
"syscall" | ||
) | ||
|
||
func configureDetachedProcess(cmd *exec.Cmd) { | ||
cmd.SysProcAttr = &syscall.SysProcAttr{ | ||
CreationFlags: syscall.CREATE_NEW_PROCESS_GROUP, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters