effection icon indicating copy to clipboard operation
effection copied to clipboard

Include a portion of process output in a failed `process.expect()`

Open cowboyd opened this issue 3 years ago • 2 comments

When you use exec().expect() and it fails, usually the most helpful thing is to see stdout to see what the program itself thought about why it was failing. However, all you get are the exit code and the environment in the error message, and not any output. As a result it can be difficult to diagnose.

see https://github.com/thefrontside/effection/blob/v2/packages/process/src/exec/posix.ts#L26-L30

As a workaround, use process.join() instead and manually generate the error message from stdout

cowboyd avatar Jul 14 '22 14:07 cowboyd

@cowboyd so we do need to add stderr to error that's omitted? What about stdout? Also, the link doesn't work

taras avatar Jul 14 '22 14:07 taras

I think so, yes… maybe the last 25 lines of each?

cowboyd avatar Jul 19 '22 12:07 cowboyd

This is a wont fix since v3 core does not have a process api, and we may need to ship a separate one for Deno, Bun, Node

cowboyd avatar Dec 18 '23 18:12 cowboyd