From 3d7df54d20c00d1497b0fa15f88a69bd7494a329 Mon Sep 17 00:00:00 2001 From: Matthew Faltys Date: Fri, 8 Nov 2019 20:55:28 +0000 Subject: [PATCH] Add run command --- nethack-launcher.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/nethack-launcher.go b/nethack-launcher.go index b0360c4..ce7bbf1 100644 --- a/nethack-launcher.go +++ b/nethack-launcher.go @@ -163,7 +163,7 @@ func printUserScreen(redisClient *redis.Client, username string) string { println("") println(" l) Logout") println(" w) Watch games in progress") - println(" p) Play NetHack 3.4.3") + println(" p) Play NetHack 3.6.0") println(" q) Quit") println("") fmt.Printf(">> ") @@ -186,7 +186,12 @@ func printUserScreen(redisClient *redis.Client, username string) string { // restart display exec.Command("stty", "-F", "/dev/tty", "echo", "-cbreak").Run() 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": clearScreen() os.Exit(0)