From c2292ef52fb40869c9159e014faa3e9b2c95963a Mon Sep 17 00:00:00 2001 From: Dennis Kempin Date: Wed, 25 May 2022 21:11:13 +0000 Subject: [PATCH] dev_container: Keep alive with 'sleep infinity' We run a neverending command in the container to keep it alive in the background. By default, this would be bash, which does the job when --tty is specified. But we no longer do that all the time. Instead we can use sleep, which does not rely on such tricks. BUG=b:233913455 TEST=./tools/dev_container true Change-Id: I2d04aabbef6b670daf6b94fdc2c65c7bd759c61b Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/3669682 Tested-by: kokoro Reviewed-by: Daniel Verkamp --- tools/dev_container | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/dev_container b/tools/dev_container index e6c3638b32..8779154d85 100755 --- a/tools/dev_container +++ b/tools/dev_container @@ -109,8 +109,9 @@ def main( container_id = None if not container_id: + # Run neverending sleep to keep container alive while we 'docker exec' commands. container_id = docker( - f"run --detach --name {CONTAINER_NAME}", *tty_args, *docker_args + f"run --detach --name {CONTAINER_NAME}", *docker_args, "sleep infinity" ).stdout() print(f"Started dev-container ({container_id}).") else: