gajus / turbowatch

Extremely fast file change detector and task orchestrator for Node.js.
Other
938 stars 23 forks source link

Silently Breaks without Bash #43

Open jpulec opened 1 year ago

jpulec commented 1 year ago

It seems that trying to use spawn with a parameter (i.e. spawn`yarn build --filter=${workspace}`) breaks if bash is not present. This is because zx doesn't set a default quote function when it cannot find bash. Normally, this would throw an error, however, since we're wrapping $() with .nothrow() in createSpawn() this issue is silent and makes it appear that our onChange() handler is hanging forever.

Expected Behavior

Try to support shells besides bash, or at least document this.

Current Behavior

The spawn command just appears to hang.

Steps to Reproduce

Run spawn inside onChange() with a parameter, using an environment that doesn't have bash, i.e. Alpine linux.

gajus commented 1 year ago

@jpulec Will improve error handling for this.

Just my awareness, in what scenario would bash be not available?

jpulec commented 1 year ago

The most likely case is when using a minimal distro like Alpine Linux, which uses BusyBox as its default shell, and doesn't include bash. It's fairly common for people to use Alpine when building docker images for their applications to keep the app size down.

gajus commented 1 year ago

That makes sense, though why would you attempt run turbowatch inside a busybox container?

jpulec commented 1 year ago

We do all of our development in containers, and in an effort to keep them similar to our production containers, use the same Alpine base image instead of using a different base image for development.

gajus commented 1 year ago

Useful context. Thank you.