- start VM processes suspended so children cannot escape the VM's job - read Hyper-V Administrators from the member list, not the sign-in token - accept the "open" action the app sends for Remote Desktop and VMConnect Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
52 lines
880 B
Go
52 lines
880 B
Go
//go:build !windows
|
|
|
|
package plugin
|
|
|
|
import (
|
|
"os/exec"
|
|
"sync"
|
|
"syscall"
|
|
)
|
|
|
|
func configureSidecarCmd(cmd *exec.Cmd) {
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
|
}
|
|
|
|
func configureDetachedVMProcess(cmd *exec.Cmd) {
|
|
cmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
|
|
}
|
|
|
|
func configureNestedVMProcess(cmd *exec.Cmd) { configureDetachedVMProcess(cmd) }
|
|
|
|
func resumeVMProcess(int) error { return nil }
|
|
|
|
func isBreakawayDenied(error) bool { return false }
|
|
|
|
type sidecarJob struct {
|
|
pgid int
|
|
closeOnce sync.Once
|
|
}
|
|
|
|
func newSidecarJob(_ uintptr) (*sidecarJob, error) {
|
|
return &sidecarJob{}, nil
|
|
}
|
|
|
|
func (j *sidecarJob) Assign(pid int) error {
|
|
if j != nil {
|
|
j.pgid = pid
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func (j *sidecarJob) Close() {
|
|
if j == nil {
|
|
return
|
|
}
|
|
j.closeOnce.Do(func() {
|
|
if j.pgid > 0 {
|
|
_ = syscall.Kill(-j.pgid, syscall.SIGKILL)
|
|
j.pgid = 0
|
|
}
|
|
})
|
|
}
|