logs: fix `logs.disabled` on Windows (#17199)
On Windows the executor returns an error when trying to open the `NUL` device when we pass it `os.DevNull` for the stdout/stderr paths. Instead of opening the device, use the discard pipe so that we have platform-specific behavior from the executor itself. Fixes: #17148
This commit is contained in:
parent
96f7c84e4e
commit
fe29cf8b7b
|
@ -0,0 +1,3 @@
|
||||||
|
```release-note:bug
|
||||||
|
logs: Fixed a bug where disabling log collection would prevent Windows tasks from starting
|
||||||
|
```
|
|
@ -181,7 +181,7 @@ func (nopCloser) Close() error { return nil }
|
||||||
// Stdout returns a writer for the configured file descriptor
|
// Stdout returns a writer for the configured file descriptor
|
||||||
func (c *ExecCommand) Stdout() (io.WriteCloser, error) {
|
func (c *ExecCommand) Stdout() (io.WriteCloser, error) {
|
||||||
if c.stdout == nil {
|
if c.stdout == nil {
|
||||||
if c.StdoutPath != "" {
|
if c.StdoutPath != "" && c.StdoutPath != os.DevNull {
|
||||||
f, err := fifo.OpenWriter(c.StdoutPath)
|
f, err := fifo.OpenWriter(c.StdoutPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create stdout: %v", err)
|
return nil, fmt.Errorf("failed to create stdout: %v", err)
|
||||||
|
@ -197,7 +197,7 @@ func (c *ExecCommand) Stdout() (io.WriteCloser, error) {
|
||||||
// Stderr returns a writer for the configured file descriptor
|
// Stderr returns a writer for the configured file descriptor
|
||||||
func (c *ExecCommand) Stderr() (io.WriteCloser, error) {
|
func (c *ExecCommand) Stderr() (io.WriteCloser, error) {
|
||||||
if c.stderr == nil {
|
if c.stderr == nil {
|
||||||
if c.StderrPath != "" {
|
if c.StderrPath != "" && c.StderrPath != os.DevNull {
|
||||||
f, err := fifo.OpenWriter(c.StderrPath)
|
f, err := fifo.OpenWriter(c.StderrPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("failed to create stderr: %v", err)
|
return nil, fmt.Errorf("failed to create stderr: %v", err)
|
||||||
|
|
Loading…
Reference in New Issue