This repository has been archived by the owner on Sep 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create secman iostrams tty_size functions, update modules
- Loading branch information
Showing
3 changed files
with
44 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
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,23 @@ | ||
//go:build !windows | ||
// +build !windows | ||
|
||
package ios | ||
|
||
import ( | ||
"os" | ||
|
||
"golang.org/x/term" | ||
) | ||
|
||
// ttySize measures the size of the controlling terminal for the current process | ||
func ttySize() (int, int, error) { | ||
f, err := os.Open("/dev/tty") | ||
|
||
if err != nil { | ||
return -1, -1, err | ||
} | ||
|
||
defer f.Close() | ||
|
||
return term.GetSize(int(f.Fd())) | ||
} |
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,19 @@ | ||
package ios | ||
|
||
import ( | ||
"os" | ||
|
||
"golang.org/x/term" | ||
) | ||
|
||
func ttySize() (int, int, error) { | ||
f, err := os.Open("CONOUT$") | ||
|
||
if err != nil { | ||
return -1, -1, err | ||
} | ||
|
||
defer f.Close() | ||
|
||
return term.GetSize(int(f.Fd())) | ||
} |