Skip to content
Snippets Groups Projects

Resolve "Exiting gosdnc causes the input in cli to be invisble"

1 file
+ 11
1
Compare changes
  • Side-by-side
  • Inline
+ 11
1
@@ -33,6 +33,7 @@ package cmd
import (
"os"
"os/exec"
"strings"
"code.fbi.h-da.de/danet/gosdn/cli/completer"
@@ -42,6 +43,7 @@ import (
"github.com/openconfig/goyang/pkg/yang"
"github.com/pterm/pterm"
"github.com/pterm/pterm/putils"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
@@ -386,8 +388,16 @@ var exitCmd = &cobra.Command{
Long: `The exit command exits the interactive prompt mode.`,
RunE: func(cmd *cobra.Command, args []string) error {
os.Exit(0)
rawModeOff := exec.Command("/bin/stty", "-raw", "echo")
rawModeOff.Stdin = os.Stdin
err := rawModeOff.Run()
if err != nil {
logrus.Error(err)
os.Exit(1)
}
os.Exit(0)
return nil
},
}
Loading