Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
github
hub
提交
67886f75
H
hub
项目概览
github
/
hub
12 个月 前同步成功
通知
3
Star
22523
Fork
2406
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
67886f75
编写于
10月 22, 2014
作者:
O
Owen Ou
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix Windows build
Use github.com/mattn/go-isatty to check terminal
上级
456adff2
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
97 addition
and
11 deletion
+97
-11
Godeps/Godeps.json
Godeps/Godeps.json
+4
-0
Godeps/_workspace/src/github.com/mattn/go-isatty/README.md
Godeps/_workspace/src/github.com/mattn/go-isatty/README.md
+37
-0
Godeps/_workspace/src/github.com/mattn/go-isatty/doc.go
Godeps/_workspace/src/github.com/mattn/go-isatty/doc.go
+2
-0
Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_bsd.go
...s/_workspace/src/github.com/mattn/go-isatty/isatty_bsd.go
+17
-0
Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_linux.go
..._workspace/src/github.com/mattn/go-isatty/isatty_linux.go
+17
-0
Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_windows.go
...orkspace/src/github.com/mattn/go-isatty/isatty_windows.go
+18
-0
github/util.go
github/util.go
+2
-4
github/util_windows.go
github/util_windows.go
+0
-7
未找到文件。
Godeps/Godeps.json
浏览文件 @
67886f75
...
...
@@ -63,6 +63,10 @@
"ImportPath"
:
"github.com/kr/text"
,
"Rev"
:
"6807e777504f54ad073ecef66747de158294b639"
},
{
"ImportPath"
:
"github.com/mattn/go-isatty"
,
"Rev"
:
"fdbe02a1b44e75977b2690062b83cf507d70c013"
},
{
"ImportPath"
:
"github.com/octokit/go-octokit/octokit"
,
"Comment"
:
"v0.4.0-93-g76c898e"
,
...
...
Godeps/_workspace/src/github.com/mattn/go-isatty/README.md
0 → 100644
浏览文件 @
67886f75
# go-isatty
isatty for golang
## Usage
```
go
package
main
import
(
"fmt"
"github.com/mattn/go-isatty"
"os"
)
func
main
()
{
if
isatty
.
IsTerminal
(
os
.
Stdout
.
Fd
())
{
fmt
.
Println
(
"Is Terminal"
)
}
else
{
fmt
.
Println
(
"Is Not Terminal"
)
}
}
```
## Installation
```
$ go get github.com/mattn/go-isatty
```
# License
MIT
# Author
Yasuhiro Matsumoto (a.k.a mattn)
Godeps/_workspace/src/github.com/mattn/go-isatty/doc.go
0 → 100644
浏览文件 @
67886f75
// Package isatty implements interface to isatty
package
isatty
Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_bsd.go
0 → 100644
浏览文件 @
67886f75
// +build darwin freebsd
package
isatty
import
(
"syscall"
"unsafe"
)
const
ioctlReadTermios
=
syscall
.
TIOCGETA
// IsTerminal return true if the file descriptor is terminal.
func
IsTerminal
(
fd
uintptr
)
bool
{
var
termios
syscall
.
Termios
_
,
_
,
err
:=
syscall
.
Syscall6
(
syscall
.
SYS_IOCTL
,
fd
,
ioctlReadTermios
,
uintptr
(
unsafe
.
Pointer
(
&
termios
)),
0
,
0
,
0
)
return
err
==
0
}
Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_linux.go
0 → 100644
浏览文件 @
67886f75
// +build linux
package
isatty
import
(
"syscall"
"unsafe"
)
const
ioctlReadTermios
=
syscall
.
TCGETS
// IsTerminal return true if the file descriptor is terminal.
func
IsTerminal
(
fd
uintptr
)
bool
{
var
termios
syscall
.
Termios
_
,
_
,
err
:=
syscall
.
Syscall6
(
syscall
.
SYS_IOCTL
,
fd
,
ioctlReadTermios
,
uintptr
(
unsafe
.
Pointer
(
&
termios
)),
0
,
0
,
0
)
return
err
==
0
}
Godeps/_workspace/src/github.com/mattn/go-isatty/isatty_windows.go
0 → 100644
浏览文件 @
67886f75
// +build windows
package
isatty
import
(
"syscall"
"unsafe"
)
var
kernel32
=
syscall
.
NewLazyDLL
(
"kernel32.dll"
)
var
procGetConsoleMode
=
kernel32
.
NewProc
(
"GetConsoleMode"
)
// IsTerminal return true if the file descriptor is terminal.
func
IsTerminal
(
fd
uintptr
)
bool
{
var
st
uint32
r
,
_
,
e
:=
syscall
.
Syscall
(
procGetConsoleMode
.
Addr
(),
2
,
fd
,
uintptr
(
unsafe
.
Pointer
(
&
st
)),
0
)
return
r
!=
0
&&
e
==
0
}
github/util.go
浏览文件 @
67886f75
// +build !windows
package
github
import
(
"code.google.com/p/go.crypto/ssh/terminal"
"github.com/github/hub/git"
"github.com/mattn/go-isatty"
)
func
IsHttpsProtocol
()
bool
{
...
...
@@ -22,5 +20,5 @@ func IsHttpsProtocol() bool {
}
func
isTerminal
(
fd
uintptr
)
bool
{
return
terminal
.
IsTerminal
(
int
(
fd
)
)
return
isatty
.
IsTerminal
(
fd
)
}
github/util_windows.go
已删除
100644 → 0
浏览文件 @
456adff2
// +build windows
package
github
func
isTerminal
(
fd
uintptr
)
bool
{
return
true
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录