Skip to content

Commit c43b287

Browse files
authored
Merge pull request #31 from enool/remove-int-handler
term: remove interrupt handler on termios
2 parents abb1982 + 94b314a commit c43b287

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

term.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ package term
77

88
import (
99
"errors"
10-
"fmt"
1110
"io"
1211
"os"
13-
"os/signal"
1412

1513
"golang.org/x/sys/unix"
1614
)
@@ -80,7 +78,6 @@ func DisableEcho(fd uintptr, state *State) error {
8078
if err := tcset(fd, &newState); err != nil {
8179
return err
8280
}
83-
handleInterrupt(fd, state)
8481
return nil
8582
}
8683

@@ -92,7 +89,6 @@ func SetRawTerminal(fd uintptr) (*State, error) {
9289
if err != nil {
9390
return nil, err
9491
}
95-
handleInterrupt(fd, oldState)
9692
return oldState, err
9793
}
9894

@@ -102,18 +98,3 @@ func SetRawTerminal(fd uintptr) (*State, error) {
10298
func SetRawTerminalOutput(fd uintptr) (*State, error) {
10399
return nil, nil
104100
}
105-
106-
func handleInterrupt(fd uintptr, state *State) {
107-
sigchan := make(chan os.Signal, 1)
108-
signal.Notify(sigchan, os.Interrupt)
109-
go func() {
110-
for range sigchan {
111-
// quit cleanly and the new terminal item is on a new line
112-
fmt.Println()
113-
signal.Stop(sigchan)
114-
close(sigchan)
115-
RestoreTerminal(fd, state)
116-
os.Exit(1)
117-
}
118-
}()
119-
}

0 commit comments

Comments
 (0)