瀏覽代碼

vendor: github.com/moby/term v0.0.0-20221205130635-1aeaba878587

term: remove interrupt handler on termios

On termios platforms, interrupt signals are not generated in raw mode
terminals as the ISIG setting is not enabled. Remove interrupt handler
as it does nothing for raw mode and prevents other uses of INT signal
with this library.

This code seems to go back all the way to moby/moby#214 where signal
handling was improved for monolithic docker repository. Raw mode -ISIG
got reintroduced in moby/moby@3f63b878076, but the INT handler was left
behind.

full diff: https://github.com/moby/term/compare/abb19827d345...1aeaba8785877a66f57739be9fccb6f5cfab429e

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Sebastiaan van Stijn 2 年之前
父節點
當前提交
c1d420ec60
共有 4 個文件被更改,包括 4 次插入23 次删除
  1. 1 1
      vendor.mod
  2. 2 2
      vendor.sum
  3. 0 19
      vendor/github.com/moby/term/term.go
  4. 1 1
      vendor/modules.txt

+ 1 - 1
vendor.mod

@@ -67,7 +67,7 @@ require (
 	github.com/moby/sys/sequential v0.5.0
 	github.com/moby/sys/sequential v0.5.0
 	github.com/moby/sys/signal v0.7.0
 	github.com/moby/sys/signal v0.7.0
 	github.com/moby/sys/symlink v0.2.0
 	github.com/moby/sys/symlink v0.2.0
-	github.com/moby/term v0.0.0-20221120202655-abb19827d345
+	github.com/moby/term v0.0.0-20221205130635-1aeaba878587
 	github.com/morikuni/aec v1.0.0
 	github.com/morikuni/aec v1.0.0
 	github.com/opencontainers/go-digest v1.0.0
 	github.com/opencontainers/go-digest v1.0.0
 	github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b
 	github.com/opencontainers/image-spec v1.1.0-rc2.0.20221005185240-3a7f492d3f1b

+ 2 - 2
vendor.sum

@@ -1072,8 +1072,8 @@ github.com/moby/sys/symlink v0.2.0 h1:tk1rOM+Ljp0nFmfOIBtlV3rTDlWOwFRhjEeAhZB0nZ
 github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs=
 github.com/moby/sys/symlink v0.2.0/go.mod h1:7uZVF2dqJjG/NsClqul95CqKOBRQyYSNnJ6BMgR/gFs=
 github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo=
 github.com/moby/term v0.0.0-20200312100748-672ec06f55cd/go.mod h1:DdlQx2hp0Ss5/fLikoLlEeIYiATotOjgB//nb973jeo=
 github.com/moby/term v0.0.0-20200915141129-7f0af18e79f2/go.mod h1:TjQg8pa4iejrUrjiz0MCtMV38jdMNW4doKSiBrEvCQQ=
 github.com/moby/term v0.0.0-20200915141129-7f0af18e79f2/go.mod h1:TjQg8pa4iejrUrjiz0MCtMV38jdMNW4doKSiBrEvCQQ=
-github.com/moby/term v0.0.0-20221120202655-abb19827d345 h1:J9c53/kxIH+2nTKBEfZYFMlhghtHpIHSXpm5VRGHSnU=
-github.com/moby/term v0.0.0-20221120202655-abb19827d345/go.mod h1:15ce4BGCFxt7I5NQKT+HV0yEDxmf6fSysfEDiVo3zFM=
+github.com/moby/term v0.0.0-20221205130635-1aeaba878587 h1:HfkjXDfhgVaN5rmueG8cL8KKeFNecRCXFhaJ2qZ5SKA=
+github.com/moby/term v0.0.0-20221205130635-1aeaba878587/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y=
 github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
 github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
 github.com/modern-go/reflect2 v0.0.0-20180320133207-05fbef0ca5da/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=

+ 0 - 19
vendor/github.com/moby/term/term.go

@@ -7,10 +7,8 @@ package term
 
 
 import (
 import (
 	"errors"
 	"errors"
-	"fmt"
 	"io"
 	"io"
 	"os"
 	"os"
-	"os/signal"
 
 
 	"golang.org/x/sys/unix"
 	"golang.org/x/sys/unix"
 )
 )
@@ -80,7 +78,6 @@ func DisableEcho(fd uintptr, state *State) error {
 	if err := tcset(fd, &newState); err != nil {
 	if err := tcset(fd, &newState); err != nil {
 		return err
 		return err
 	}
 	}
-	handleInterrupt(fd, state)
 	return nil
 	return nil
 }
 }
 
 
@@ -92,7 +89,6 @@ func SetRawTerminal(fd uintptr) (*State, error) {
 	if err != nil {
 	if err != nil {
 		return nil, err
 		return nil, err
 	}
 	}
-	handleInterrupt(fd, oldState)
 	return oldState, err
 	return oldState, err
 }
 }
 
 
@@ -102,18 +98,3 @@ func SetRawTerminal(fd uintptr) (*State, error) {
 func SetRawTerminalOutput(fd uintptr) (*State, error) {
 func SetRawTerminalOutput(fd uintptr) (*State, error) {
 	return nil, nil
 	return nil, nil
 }
 }
-
-func handleInterrupt(fd uintptr, state *State) {
-	sigchan := make(chan os.Signal, 1)
-	signal.Notify(sigchan, os.Interrupt)
-	go func() {
-		for range sigchan {
-			// quit cleanly and the new terminal item is on a new line
-			fmt.Println()
-			signal.Stop(sigchan)
-			close(sigchan)
-			RestoreTerminal(fd, state)
-			os.Exit(1)
-		}
-	}()
-}

+ 1 - 1
vendor/modules.txt

@@ -819,7 +819,7 @@ github.com/moby/sys/signal
 # github.com/moby/sys/symlink v0.2.0
 # github.com/moby/sys/symlink v0.2.0
 ## explicit; go 1.16
 ## explicit; go 1.16
 github.com/moby/sys/symlink
 github.com/moby/sys/symlink
-# github.com/moby/term v0.0.0-20221120202655-abb19827d345
+# github.com/moby/term v0.0.0-20221205130635-1aeaba878587
 ## explicit; go 1.18
 ## explicit; go 1.18
 github.com/moby/term
 github.com/moby/term
 github.com/moby/term/windows
 github.com/moby/term/windows