@@ -21,9 +21,15 @@ type impl struct {
2121
2222 // Slave is the slave PTY file descriptor.
2323 Slave * os.File
24+ }
25+
26+ func (i * impl ) IsZero () bool {
27+ return i .Master == nil && i .Slave == nil
28+ }
2429
25- // Name is the name of the slave PTY.
26- Name string
30+ // Name returns the name of the slave PTY.
31+ func (i * impl ) Name () string {
32+ return i .Slave .Name ()
2733}
2834
2935// Read implements ptyInterface.
@@ -60,10 +66,13 @@ func (i *impl) Resize(w int, h int) (rErr error) {
6066}
6167
6268func (i * impl ) start (c * exec.Cmd ) error {
63- c .Stdin , c .Stdout , c .Stderr : = i .Slave , i .Slave , i .Slave
69+ c .Stdin , c .Stdout , c .Stderr = i .Slave , i .Slave , i .Slave
6470 if c .SysProcAttr == nil {
6571 c .SysProcAttr = & syscall.SysProcAttr {}
6672 }
73+ c .SysProcAttr .Setctty = true
74+ c .SysProcAttr .Setsid = true
75+ return c .Start ()
6776}
6877
6978func newPty (_ Context , _ string , win Window , modes ssh.TerminalModes ) (_ impl , rErr error ) {
@@ -83,7 +92,7 @@ func newPty(_ Context, _ string, win Window, modes ssh.TerminalModes) (_ impl, r
8392 return impl {}, err
8493 }
8594
86- return impl {Master : ptm , Slave : pts , Name : pts . Name () }, rErr
95+ return impl {Master : ptm , Slave : pts }, rErr
8796}
8897
8998func applyTerminalModesToFd (fd uintptr , width int , height int , modes ssh.TerminalModes ) error {
0 commit comments