Closed ijc closed 7 years ago
Maybe we should have a better API for this in the lib.
opts := &CreateOpts{}
opts.AddFile(f)
opts.AddFile(f)
runc.Create(..., opts)
This way we can provide a better UX for people wanting to add to the ExtraFiles and not assume that they are matched with the same fd of the calling process.
Either an add file method or just add ExtraFiles []*os.File
to the create opts and we can populate the preserve flag based on the len of that slice.
Adding ExtraFiles []*os.File
to CreateOpts
was my first (unpublished) cut. It potentially pushes the for loop which populates the cmd.ExtraFiles
to the caller (it becomes a simple assignment here), but for others they will already have them all in their hand already (and with meaningful names) so this does sound more convenient overall. I'll make that change.
It's beautiful
Signed-off-by: Ian Campbell ian.campbell@docker.com