You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/ssh/src/tunnel.ts
+21-1Lines changed: 21 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -426,10 +426,26 @@ fi
426
426
if command -v t3 >/dev/null 2>&1; then
427
427
exec t3 "$@"
428
428
fi
429
+
# npm extracts a package before it runs the native builds of its dependencies,
430
+
# so a failed build (t3 depends on node-pty, which needs a C toolchain) leaves
431
+
# the npx cache without a t3 executable. \`npx --yes\` then exits 0 without
432
+
# running anything at all, which the caller only ever sees as a server that
433
+
# never becomes ready. Resolve the CLI once up front so that install failure is
434
+
# reported here, with npm's own output on stderr.
435
+
require_installed_t3_cli() {
436
+
T3_CLI_PATH="$("$@" -- sh -c 'command -v t3' || true)"
437
+
if [ -n "$T3_CLI_PATH" ]; then
438
+
return 0
439
+
fi
440
+
printf 'Remote host installed %s but npm produced no t3 executable, which usually means a native dependency (node-pty) failed to build. Install a C toolchain on the remote host (Debian/Ubuntu: build-essential, Fedora/RHEL: gcc-c++ make, macOS: xcode-select --install) and try again.\\n' @@T3_PACKAGE_SPEC@@ >&2
printf 'Remote host is missing the t3 CLI and could not install @@T3_PACKAGE_SPEC@@ because node/npm/npx are unavailable on PATH. Install Node or configure a supported version manager for non-interactive shells.\\n' >&2
@@ -581,7 +597,11 @@ if [ -z "$REMOTE_PORT" ]; then
581
597
printf 'managed\\n' >"$MANAGED_FILE"
582
598
if ! wait_ready "@@T3_READY_TIMEOUT_MS@@"; then
583
599
printf 'Remote T3 server did not become ready on 127.0.0.1:%s.\\n' "$REMOTE_PORT" >&2
584
-
tail -n 80 "$LOG_FILE" >&2 2>/dev/null || true
600
+
if [ -s "$LOG_FILE" ]; then
601
+
tail -n 80 "$LOG_FILE" >&2 2>/dev/null || true
602
+
else
603
+
printf 'It wrote nothing to %s, so it exited before producing any output.\\n' "$LOG_FILE" >&2
0 commit comments