コード例 #1
0
ファイル: main.go プロジェクト: carriercomm/doenter
func write(s serial.Port) {
	for {
		reader := bufio.NewReader(os.Stdin)
		text, _ := reader.ReadString('\n')
		s.Write([]byte(text))
	}
}
コード例 #2
0
ファイル: main.go プロジェクト: carriercomm/doenter
// This functions handles signals to the main process and routes them to the VM
func sigh(s serial.Port) {
	sigchan := make(chan os.Signal, 1)
	signal.Notify(sigchan)

	ascii := map[os.Signal]string{
		syscall.SIGINT:  "\x03",
		syscall.SIGTSTP: "\x1A",
	}

	for sig := range sigchan {
		if val, ok := ascii[sig]; ok {
			s.Write([]byte(val))
		}
	}
}