Browse Source

Add run command

master
Matthew Faltys 5 years ago
parent
commit
3d7df54d20
  1. 9
      nethack-launcher.go

9
nethack-launcher.go

@ -163,7 +163,7 @@ func printUserScreen(redisClient *redis.Client, username string) string {
println("") println("")
println(" l) Logout") println(" l) Logout")
println(" w) Watch games in progress") println(" w) Watch games in progress")
println(" p) Play NetHack 3.4.3") println(" p) Play NetHack 3.6.0")
println(" q) Quit") println(" q) Quit")
println("") println("")
fmt.Printf(">> ") fmt.Printf(">> ")
@ -186,7 +186,12 @@ func printUserScreen(redisClient *redis.Client, username string) string {
// restart display // restart display
exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run()
clearScreen() clearScreen()
os.Exit(0) nh := exec.Command("nethack", "-u", username)
nh.Stdout = os.Stdout
nh.Stdin = os.Stdin
nh.Stderr = os.Stderr
nh.Run()
printUserScreen(redisClient, username)
case "q": case "q":
clearScreen() clearScreen()
os.Exit(0) os.Exit(0)

Loading…
Cancel
Save