Esempio n. 1
0
func handleSignals() {
	signals := make(chan os.Signal, 1)
	signal.Notify(signals, syscall.SIGWINCH)

	for s := range signals {
		switch s {
		case syscall.SIGWINCH:
			C.rl_resize_terminal()
		}
	}
}
Esempio n. 2
0
// https://code.google.com/p/go/issues/detail?id=4216
func init() {
	// Program received signal SIGSEGV, Segmentation fault.
	// rl_sigwinch_handler (sig=-136463680) at /tmp/buildd/readline6-6.2+dfsg/signals.c:267
	// 267	  RL_UNSETSTATE(RL_STATE_SIGHANDLER);
	C.rl_catch_sigwinch = 0
	resized := make(chan os.Signal, 1)
	go func() {
		for _ = range resized {
			C.rl_resize_terminal()
		}
	}()
	signal.Notify(resized, syscall.SIGWINCH)
}
Esempio n. 3
0
func initReadLine() {
	C.rl_catch_sigwinch = 0
	C.rl_catch_signals = 0
	c := make(chan os.Signal, 1)
	signal.Notify(c, syscall.SIGWINCH)
	signal.Notify(c, os.Interrupt)
	go func() {
		for sig := range c {
			switch sig {
			case syscall.SIGWINCH:
				C.rl_resize_terminal()

			case os.Interrupt:
				C.rl_cleanup_after_signal()
			default:

			}
		}
	}()
}
Esempio n. 4
0
func handleSignals() {
	C.rl_catch_signals = 0
	C.rl_catch_sigwinch = 0

	signals := make(chan os.Signal, 2)
	signal.Notify(signals, syscall.SIGINT, syscall.SIGWINCH)

	for s := range signals {
		switch s {
		case syscall.SIGWINCH:
			C.rl_resize_terminal()

		case syscall.SIGINT:
			if CatchSigint {
				Cleanup()
				os.Exit(1)
			}
		}
	}
}
Esempio n. 5
0
func Resize() {
	C.rl_resize_terminal()
}
Esempio n. 6
0
func handleSignals() {
	signals := make(chan os.Signal)
	signal.Notify(signals, syscall.SIGWINCH)
	<-signals
	C.rl_resize_terminal()
}