Fix cases where ctr wouldn't properly restore the terminal termios
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
54c213e8a7
commit
cad6fb95ab
2 changed files with 38 additions and 16 deletions
15
ctr/main.go
15
ctr/main.go
|
@ -11,7 +11,20 @@ import (
|
|||
|
||||
const usage = `High performance container daemon cli`
|
||||
|
||||
type Exit struct {
|
||||
Code int
|
||||
}
|
||||
|
||||
func main() {
|
||||
// We want our defer functions to be run when calling fatal()
|
||||
defer func() {
|
||||
if e := recover(); e != nil {
|
||||
if ex, ok := e.(Exit); ok == true {
|
||||
os.Exit(ex.Code)
|
||||
}
|
||||
panic(e)
|
||||
}
|
||||
}()
|
||||
app := cli.NewApp()
|
||||
app.Name = "ctr"
|
||||
if containerd.GitCommit != "" {
|
||||
|
@ -50,5 +63,5 @@ func main() {
|
|||
|
||||
func fatal(err string, code int) {
|
||||
fmt.Fprintf(os.Stderr, "[ctr] %s\n", err)
|
||||
os.Exit(code)
|
||||
panic(Exit{code})
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue