-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Warn if running in TTY on windows
Signed-off-by: Dana Pieluszczak <[email protected]>
Showing
4 changed files
with
30 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package os_specific | ||
|
||
import ( | ||
"io" | ||
"os/exec" | ||
) | ||
|
||
func simpleStart(cmd *exec.Cmd, stdout io.Writer, stderr io.Writer) (func(), error) { | ||
cmd.Stdout = stdout | ||
cmd.Stderr = stderr | ||
|
||
if err := cmd.Start(); err != nil { | ||
return nil, err | ||
} | ||
|
||
return func() {}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,19 @@ | ||
//go:build windows | ||
package os_specific | ||
|
||
import ( | ||
"io" | ||
"os" | ||
"os/exec" | ||
"io" | ||
) | ||
|
||
func StartCommand(cmd *exec.Cmd, stdin *os.File, stdout io.Writer, stderr io.Writer) (func(), error) { | ||
closer := func() {} | ||
log "github.com/sirupsen/logrus" | ||
"golang.org/x/term" | ||
) | ||
|
||
cmd.Stdout = stdout | ||
cmd.Stderr = stderr | ||
var logger = log.WithField("argo", true) | ||
|
||
if err := cmd.Start(); err != nil { | ||
return nil, err | ||
func StartCommand(cmd *exec.Cmd, stdin *os.File, stdout io.Writer, stderr io.Writer) (func(), error) { | ||
if term.IsTerminal(int(stdin.Fd())) { | ||
logger.Warn("TTY detected but is not supported on windows") | ||
} | ||
|
||
return closer, nil | ||
return simpleStart(cmd, stdout, stderr) | ||
} |