mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
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:
3
.changelog/17199.txt
Normal file
3
.changelog/17199.txt
Normal file
@@ -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
|
||||
func (c *ExecCommand) Stdout() (io.WriteCloser, error) {
|
||||
if c.stdout == nil {
|
||||
if c.StdoutPath != "" {
|
||||
if c.StdoutPath != "" && c.StdoutPath != os.DevNull {
|
||||
f, err := fifo.OpenWriter(c.StdoutPath)
|
||||
if err != nil {
|
||||
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
|
||||
func (c *ExecCommand) Stderr() (io.WriteCloser, error) {
|
||||
if c.stderr == nil {
|
||||
if c.StderrPath != "" {
|
||||
if c.StderrPath != "" && c.StderrPath != os.DevNull {
|
||||
f, err := fifo.OpenWriter(c.StderrPath)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to create stderr: %v", err)
|
||||
|
||||
Reference in New Issue
Block a user