gosh: Fix concurrency bug
Change-Id: Ifbf5e1fdae3c4f16cc6282714e3fd1d4262711ef
diff --git a/gosh/shell.go b/gosh/shell.go
index 9d6dd1d..a1cee3a 100644
--- a/gosh/shell.go
+++ b/gosh/shell.go
@@ -482,10 +482,10 @@
 			continue
 		}
 		wg.Add(1)
-		go func() {
+		go func(cmd *Cmd) {
 			defer wg.Done()
-			c.cleanupProcessGroup()
-		}()
+			cmd.cleanupProcessGroup()
+		}(c)
 	}
 	wg.Wait()
 }