mirror of
https://github.com/kemko/nomad.git
synced 2026-01-06 18:35:44 +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:
@@ -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