-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
happy lint happy lint
- Loading branch information
Showing
13 changed files
with
286 additions
and
230 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
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,25 @@ | ||
package plugin | ||
|
||
import ( | ||
"io" | ||
"os" | ||
|
||
"golang.org/x/sys/unix" | ||
) | ||
|
||
const ioctlReadTermios = unix.TCGETS | ||
|
||
func isTerminal(fd int) bool { | ||
_, err := unix.IoctlGetTermios(fd, ioctlReadTermios) | ||
return err == nil | ||
} | ||
|
||
// code from logrus | ||
func checkIfTerminal(w io.Writer) bool { | ||
switch v := w.(type) { | ||
case *os.File: | ||
return isTerminal(int(v.Fd())) | ||
default: | ||
return false | ||
} | ||
} |
Binary file not shown.
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
Oops, something went wrong.