From 342a1dfe3a788ad524692f95be140aef9b0f7ff5 Mon Sep 17 00:00:00 2001 From: Else Someone Date: Fri, 20 Feb 2026 10:50:31 +0200 Subject: [PATCH] ch-runner: another iter of cleanup prior to moving things around --- profiles/ch-runner.nix | 42 +++++++++++++++++++++++++++++++----------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/profiles/ch-runner.nix b/profiles/ch-runner.nix index dee946b..b3d0385 100644 --- a/profiles/ch-runner.nix +++ b/profiles/ch-runner.nix @@ -311,10 +311,25 @@ in } - def configure_execline(prefix, vm, check=True, **defaults): - def execline(*args, check=check, **kwargs): + def configure_exec(prefix, vm, check=True, **defaults): + + def exec(*args, check=check, **kwargs): return subprocess.run( - ["execlineb", "-c", "\n".join(args)], + [*args], + **defaults, + env={ + **PASSTHRU_ENV, + "PATH": PASSTHRU_PATH, + "PREFIX": prefix, + "VM": vm, + }, + check=check, + cwd=prefix, + **kwargs) + + def execline(*args, check=check, **kwargs): + return exec( + "execlineb", "-c", "\n".join(args), **defaults, executable=ELB_DIR + "/execlineb", env={ @@ -326,7 +341,8 @@ in check=check, cwd=prefix, **kwargs) - return execline + + return exec, execline def preprocess_args(args_mut): @@ -373,7 +389,8 @@ in ] p = subprocess.Popen( args, - shell=False) + shell=False, + pass_fds=(2,)) try: p.wait(1.0) needs_cleanup = False @@ -408,7 +425,7 @@ in preprocess_args(args) os.makedirs(args.prefix, exist_ok=True) - execline = configure_execline( + exec, _ = configure_exec( prefix=args.prefix, vm=args.vm) @@ -420,14 +437,17 @@ in with ExitStack() as cleanup: ch = cleanup.enter_context(run_ch(args.prefix)) - execline(*ch_remote, "create", args.vm_config) - execline( + exec(*ch_remote, "create", args.vm_config) + exec( TAPS_PATH, "pass", *ch_remote, "add-net", "id=wan,fd=3,mac=00:00:00:00:00:01") - execline(*ch_remote, "boot") - execline(*ch_remote, "info") - ch.wait() + exec(*ch_remote, "boot") + exec(*ch_remote, "info") + try: + ch.wait() + except KeyboardInterrupt: + pass ''; in writeElb "run-${hostName}" ''