From 5ab08f693f9b2cc0f9bb1bb55aa502ebe9625e5c Mon Sep 17 00:00:00 2001 From: Carlos Villela Date: Tue, 31 Mar 2026 21:29:33 -0700 Subject: [PATCH] fix: use sudo -n for lsof retry in preflight to avoid password prompt The port-availability check in checkPortAvailable retries with sudo lsof to detect root-owned listeners. Without -n (non-interactive), sudo blocks on a Password: prompt, stalling non-interactive installs (curl | bash, --non-interactive, NEMOCLAW_NON_INTERACTIVE=1, CI). Switch to sudo -n so it fails immediately when passwordless sudo is unavailable, falling through to the TCP bind probe instead of hanging. --- bin/lib/preflight.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/lib/preflight.js b/bin/lib/preflight.js index 604eac7dcf6..4dd8a7045d6 100644 --- a/bin/lib/preflight.js +++ b/bin/lib/preflight.js @@ -101,7 +101,7 @@ async function checkPortAvailable(port, opts) { // through to the net probe (which can only detect EADDRINUSE but not // the owning process). if (dataLines.length === 0 && !o.lsofOutput) { - const sudoOut = runCapture(`sudo lsof -i :${p} -sTCP:LISTEN -P -n 2>/dev/null`, { + const sudoOut = runCapture(`sudo -n lsof -i :${p} -sTCP:LISTEN -P -n 2>/dev/null`, { ignoreError: true, }); if (typeof sudoOut === "string") {