diff --git a/internal/proc/files.go b/internal/proc/files.go index 5a5e1c2..712713a 100644 --- a/internal/proc/files.go +++ b/internal/proc/files.go @@ -6,8 +6,12 @@ import ( ) func ExtraFile(cmd *exec.Cmd, f *os.File) (fd uintptr) { + return ExtraFileSlice(&cmd.ExtraFiles, f) +} + +func ExtraFileSlice(extraFiles *[]*os.File, 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) + fd = uintptr(3 + len(*extraFiles)) + *extraFiles = append(*extraFiles, f) return }