pi-mono/packages/env/test
Michael Yu 479d6e5e29
fix(env): include stderr in pi-env startup errors (#10716)
When the daemon exits before `hello`, the error has only the exit code.
For example, with `loginShell: true` and a profile that aborts on a
missing file:

```
pi-env exited with code 3 before it was ready
```

`sshConnection`'s probe and deploy steps already report ssh's stderr, so
this is about the launch itself: a login profile, a daemon that can't
execute, or a `Connection` created with its own command, which has no
probe or deploy step, so auth and network errors also end up here.

This keeps a short stderr tail until `hello` and adds it to startup
errors:

```
pi-env exited with code 3 before it was ready
remote stderr:
profile: /opt/toolchain/env.sh: No such file or directory
```

The tail is capped at 20 lines / 2000 chars, with terminal escapes and
control characters stripped. Ready sessions are unchanged.

I hit it while testing `loginShell` against an sshd in Docker. Tests are
in `test/connection.test.ts`, and `npm run check` and `./test.sh` pass.
2026-10-27 16:16:49 +01:00
..
conformance.test.ts feat(env): listFiles for remote and local environments, nodePlatform 2026-10-12 15:22:14 +00:00
connection.test.ts fix(env): include stderr in pi-env startup errors (#10716) 2026-10-27 16:16:49 +01:00
daemon.ts feat(env): hardened SSH bootstrap and release daemon tests 2026-10-05 17:32:22 +02:00
differential.test.ts fix(env): make the read/bash differential test deterministic and meaningful 2026-10-16 19:58:24 +00:00
old-daemon.ts feat(env): listFiles for remote and local environments, nodePlatform 2026-10-12 15:22:14 +00:00
remote.test.ts fix(env): make the listing cancel and platform tests hold in CI 2026-10-13 01:23:33 +02:00
ssh-external.test.ts feat(env): listFiles for remote and local environments, nodePlatform 2026-10-12 15:22:14 +00:00
ssh.test.ts feat(env): listFiles for remote and local environments, nodePlatform 2026-10-12 15:22:14 +00:00
terminal.test.ts test(env): wait for the foreground job's name, not just any foreground process 2026-10-12 23:19:48 +00:00