-
-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is done using the test command as the stdlib lacks any way to do this without using syscalls directly
- Loading branch information
1 parent
9ac4ab6
commit e78070e
Showing
2 changed files
with
11 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,3 +121,10 @@ func passToGit(dir string, _args ...string) *exec.Cmd { | |
cmd := exec.Command(config.GitBin, args...) | ||
return cmd | ||
} | ||
|
||
func isTty() bool { | ||
cmd := exec.Command("test", "-t", "1") | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Morganamilo
Author
Contributor
|
||
cmd.Stdout = os.Stdout | ||
err := cmd.Run() | ||
return err == 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
I don't sure
execl("test", "-t", "1", NULL)
will work or not when $PATH is empty (like in systemd service).I think it will not work.
use
mattn/go-isatty
is another bad idea,mattn/go-isatty
do not use isatty in libc, $LD_PRELOAD will not work.