Commit 3bf9894d authored by Thiago Kenji Okada's avatar Thiago Kenji Okada Committed by github-actions[bot]
Browse files

nixos-rebuild-ng: alert user if we can't clean-up remote process

(cherry picked from commit 062eaf73)
parent 621a8d5c
Loading
Loading
Loading
Loading
+37 −24
Original line number Diff line number Diff line
@@ -179,6 +179,9 @@ def _kill_long_running_ssh_process(args: Args, remote: Remote) -> None:
    # its arguments as regex)
    quoted_args = re.escape(shlex.join(str(a) for a in args))
    logger.debug("killing remote process using pkill with args=%r", quoted_args)
    cleanup_interrupted = False

    try:
        r = subprocess.run(
            [
                "ssh",
@@ -203,3 +206,13 @@ def _kill_long_running_ssh_process(args: Args, remote: Remote) -> None:
            r.stderr,
            r.returncode,
        )
    except KeyboardInterrupt:
        cleanup_interrupted = True
        raise
    finally:
        if cleanup_interrupted or r.returncode:
            logger.warning(
                "could not clean-up remote process, the command %s may still be running in host '%s'",
                args,
                remote.host,
            )