Merge "v.io/x/lib/envvar: make it easier to manipulate envvars that are paths."
diff --git a/gosh/.api b/gosh/.api
index e6a19a7..fc7b9c5 100644
--- a/gosh/.api
+++ b/gosh/.api
@@ -53,6 +53,7 @@
pkg gosh, type Cmd struct, Err error
pkg gosh, type Cmd struct, ExitAfter time.Duration
pkg gosh, type Cmd struct, ExitErrorIsOk bool
+pkg gosh, type Cmd struct, ExtraFiles []*os.File
pkg gosh, type Cmd struct, IgnoreClosedPipeError bool
pkg gosh, type Cmd struct, IgnoreParentExit bool
pkg gosh, type Cmd struct, OutputDir string
diff --git a/gosh/cmd.go b/gosh/cmd.go
index 0ab4d61..b08b2fd 100644
--- a/gosh/cmd.go
+++ b/gosh/cmd.go
@@ -61,6 +61,9 @@
// closed pipe error occurs, Cmd.Err will be nil, and no err is reported to
// Shell.HandleError.
IgnoreClosedPipeError bool
+ // ExtraFiles is used to populate ExtraFiles in the underlying exec.Cmd
+ // object. Does not get cloned.
+ ExtraFiles []*os.File
// Internal state.
sh *Shell
c *exec.Cmd
@@ -583,6 +586,7 @@
if c.c.Stdout, c.c.Stderr, err = c.makeStdoutStderr(); err != nil {
return err
}
+ c.c.ExtraFiles = c.ExtraFiles
// Start the command.
if err = c.c.Start(); err != nil {
return err