turbo-editors/turbo-corepublic Fork 0
main
Commits
Clone
git clone https://git.rickub.com/turbo-editors/turbo-core.git
git clone ssh://git@rickub.com/turbo-editors/turbo-core.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

🛟 Updated. 28d5985 · on main · k33g · 4h ago
group_other.go · 34 lines · 1.1 KBGo Blame HistoryRaw
 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
//go:build !unix && !windows

package tools

import (
	"os"
	"os/exec"
	"syscall"
)

// shellProgram is a guess on a platform this package does not know.
func shellProgram() string { return "/bin/sh" }

// shellArgs assumes a Bourne-style shell.
func shellArgs(command string) []string { return []string{"-c", command} }

// childAttributes asks for nothing on a platform without process groups.
func childAttributes(*exec.Cmd, string) *syscall.SysProcAttr { return nil }

// loneProcess is a command with nothing grouping what it started.
type loneProcess struct{ process *os.Process }

// newGroup has no group to offer.
func newGroup(process *os.Process) group { return loneProcess{process: process} }

// kill stops the process alone.
//
// Anything it started keeps running, and if that child holds the output pipe
// the run will not report itself finished until WaitDelay expires. That is the
// backstop rather than the intent; a platform-specific way to end a whole
// process tree would be the real answer here.
func (g loneProcess) kill() { _ = g.process.Kill() }

func (loneProcess) release() {}