Merge pull request #2934 from jhowardmsft/jjh/fifoset
Windows:NewDirectIOFromFIFOSet
This commit is contained in:
commit
4915476f11
@ -275,3 +275,7 @@ func Load(set *FIFOSet) (IO, error) {
|
|||||||
closers: []io.Closer{set},
|
closers: []io.Closer{set},
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *pipes) closers() []io.Closer {
|
||||||
|
return []io.Closer{p.Stdin, p.Stdout, p.Stderr}
|
||||||
|
}
|
||||||
|
@ -152,7 +152,3 @@ func NewDirectIO(ctx context.Context, fifos *FIFOSet) (*DirectIO, error) {
|
|||||||
},
|
},
|
||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *pipes) closers() []io.Closer {
|
|
||||||
return []io.Closer{p.Stdin, p.Stdout, p.Stderr}
|
|
||||||
}
|
|
||||||
|
@ -17,6 +17,7 @@
|
|||||||
package cio
|
package cio
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
@ -144,3 +145,22 @@ func NewDirectIO(stdin io.WriteCloser, stdout, stderr io.ReadCloser, terminal bo
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewDirectIOFromFIFOSet returns an IO implementation that exposes the IO streams as io.ReadCloser
|
||||||
|
// and io.WriteCloser.
|
||||||
|
func NewDirectIOFromFIFOSet(ctx context.Context, stdin io.WriteCloser, stdout, stderr io.ReadCloser, fifos *FIFOSet) *DirectIO {
|
||||||
|
_, cancel := context.WithCancel(ctx)
|
||||||
|
pipes := pipes{
|
||||||
|
Stdin: stdin,
|
||||||
|
Stdout: stdout,
|
||||||
|
Stderr: stderr,
|
||||||
|
}
|
||||||
|
return &DirectIO{
|
||||||
|
pipes: pipes,
|
||||||
|
cio: cio{
|
||||||
|
config: fifos.Config,
|
||||||
|
closers: append(pipes.closers(), fifos),
|
||||||
|
cancel: cancel,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user