proc: cleaner extra files
All checks were successful
test / test (push) Successful in 37s

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
2024-12-06 16:05:04 +09:00
parent b3ef53b193
commit cc816a1aaa
4 changed files with 27 additions and 15 deletions

13
internal/proc/files.go Normal file
View File

@@ -0,0 +1,13 @@
package proc
import (
"os"
"os/exec"
)
func ExtraFile(cmd *exec.Cmd, f *os.File) (fd uintptr) {
// ExtraFiles: If non-nil, entry i becomes file descriptor 3+i.
fd = uintptr(3 + len(cmd.ExtraFiles))
cmd.ExtraFiles = append(cmd.ExtraFiles, f)
return
}