Fix creation of DirectIO overwriting fifo config
Creating a direct IO should not overwrite the fifo configuration. The fifo configuration can be updated before creating the direct io if needed. This fixes an expected change in behavior for clients who were calling NewDirectIO previously with terminal configured on the fifo. Signed-off-by: Derek McGowan <derek@mcgstyle.net>
This commit is contained in:
@@ -141,18 +141,8 @@ func openFifos(ctx context.Context, fifos *FIFOSet) (pipes, error) {
|
||||
// NewDirectIO returns an IO implementation that exposes the IO streams as io.ReadCloser
|
||||
// and io.WriteCloser.
|
||||
func NewDirectIO(ctx context.Context, fifos *FIFOSet) (*DirectIO, error) {
|
||||
return newDirectIO(ctx, fifos, false)
|
||||
}
|
||||
|
||||
// NewDirectIOWithTerminal returns an IO implementation that exposes the streams with terminal enabled
|
||||
func NewDirectIOWithTerminal(ctx context.Context, fifos *FIFOSet) (*DirectIO, error) {
|
||||
return newDirectIO(ctx, fifos, true)
|
||||
}
|
||||
|
||||
func newDirectIO(ctx context.Context, fifos *FIFOSet, terminal bool) (*DirectIO, error) {
|
||||
ctx, cancel := context.WithCancel(ctx)
|
||||
pipes, err := openFifos(ctx, fifos)
|
||||
fifos.Config.Terminal = terminal
|
||||
return &DirectIO{
|
||||
pipes: pipes,
|
||||
cio: cio{
|
||||
|
Reference in New Issue
Block a user