refactor: type check style
This commit is contained in:
parent
7d04e739e9
commit
21b795732c
@ -11,6 +11,8 @@ import (
|
|||||||
opty "github.com/creack/pty"
|
opty "github.com/creack/pty"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ IPty = (*Pty)(nil)
|
||||||
|
|
||||||
var defaultShells = []string{"zsh", "fish", "bash", "sh"}
|
var defaultShells = []string{"zsh", "fish", "bash", "sh"}
|
||||||
|
|
||||||
type Pty struct {
|
type Pty struct {
|
||||||
@ -79,5 +81,3 @@ func (pty *Pty) Close() error {
|
|||||||
}
|
}
|
||||||
return pty.killChildProcess(pty.cmd)
|
return pty.killChildProcess(pty.cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ IPty = &Pty{}
|
|
||||||
|
@ -19,6 +19,9 @@ import (
|
|||||||
"github.com/shirou/gopsutil/v4/host"
|
"github.com/shirou/gopsutil/v4/host"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ IPty = (*winPTY)(nil)
|
||||||
|
var _ IPty = (*conPty)(nil)
|
||||||
|
|
||||||
var isWin10 = VersionCheck()
|
var isWin10 = VersionCheck()
|
||||||
|
|
||||||
type winPTY struct {
|
type winPTY struct {
|
||||||
@ -164,6 +167,3 @@ func (c *conPty) Close() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ IPty = &winPTY{}
|
|
||||||
var _ IPty = &conPty{}
|
|
||||||
|
@ -10,6 +10,8 @@ import (
|
|||||||
"github.com/UserExistsError/conpty"
|
"github.com/UserExistsError/conpty"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var _ IPty = (*Pty)(nil)
|
||||||
|
|
||||||
type Pty struct {
|
type Pty struct {
|
||||||
tty *conpty.ConPty
|
tty *conpty.ConPty
|
||||||
}
|
}
|
||||||
@ -61,5 +63,3 @@ func (pty *Pty) Close() error {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ IPty = &Pty{}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user