Fix remote deploy console encoding; allow npm install without lock.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
dekun
2026-07-24 16:36:47 +08:00
parent e51f357b48
commit 8c668ddff0
+15 -4
View File
@@ -54,12 +54,23 @@ curl -fsS http://127.0.0.1:5155/health || true
client.connect(HOST, username=USER, password=PASSWORD, timeout=30)
print("running remote bootstrap/pull ...")
stdin, stdout, stderr = client.exec_command(remote, get_pty=True)
for line in iter(stdout.readline, ""):
print(line, end="")
err = stderr.read().decode("utf-8", errors="ignore")
while True:
chunk = stdout.read(1024)
if not chunk:
break
text = chunk.decode("utf-8", errors="replace") if isinstance(chunk, bytes) else chunk
try:
print(text, end="", flush=True)
except UnicodeEncodeError:
print(text.encode("ascii", errors="replace").decode("ascii"), end="", flush=True)
err_raw = stderr.read()
err = err_raw.decode("utf-8", errors="replace") if isinstance(err_raw, bytes) else err_raw
code = stdout.channel.recv_exit_status()
if err:
print(err, file=sys.stderr)
try:
print(err, file=sys.stderr)
except UnicodeEncodeError:
print(err.encode("ascii", errors="replace").decode("ascii"), file=sys.stderr)
client.close()
print(f"exit={code}")
return code