Or if you put the sleep after the cat, you can put a setTimeout() around cli.CmdRun() in order to make sure it returns well and then use container.Kill() to stop the sleep.