4 ms·
Genuine question out of curiosity. Why do I want parallel and sequential when I can just write a simple bash script to accomplish the same thing? Is there some
by johnfn 8mo ago
Genuine question out of curiosity. Why do I want parallel and sequential when I can just write a simple bash script to accomplish the same thing? Is there some additional complexity I’m missing?
- runjake 8mo agoThis is cleaner and you don't have to write a bash script. It's one (well, several: the script, bash, and it's dependencies) less thing, which is important in containers and for scale.
- an_ko 8mo agoIt lets developers on Windows also build and test your package in parallel mode. If you make your build scripts bash, they're Linux-only.
- maccard 8mo ago> if you make your build scripts bash, they’re Linux only Git bash exists on windows and is perfectly usable.
- hu3 8mo agoIt's still much less dependable compared to something fully supported like Bun.
- maccard 8mo agoI’m no bash lover, but I’ve used git bash as my primary driver on windows for I don’t know many years. It has its quirks (like any tool) but I don’t think I’d say it’s less dependable. Anecdotally I’ve had way more issues with node on windows than I have with git bash and node is fully supported.
- throw20251220 8mo agoFully supported, until they sell it to someone.
- maccard 8mo agoI mean, Anthropic now own it
- dundarious 8mo agoYes, bash is the near-universal language for build scripts as long as git is the near-universal source control tool.
- throwa356262 8mo agoThat is an interesting point... but if I do development on windows it usually happens inside WSL :) Seriously, my number one windows shell is WSL. Distant second and third are cmd and powershell which I only use to diagnose WSL issue.
- paulddraper 8mo agoA few reasons. 1. Minor speed boost from not needing bun multiple times (or extract the build/test/lint commands from package.json). 2. You can query/filter commands. E.g. run all my tests (both unit and integration). 3.You avoid needing a separate Bash install (for Windows).
- re-thc 8mo ago> when I can just write a simple bash script to accomplish the same thing At this point you don't need most things...
- johnfn 8mo agoBut this is no more than 5 lines of code. If it was 100 I’d understand.
- rafaelmn 8mo agoI get where you're coming from and if this was a package I'd agree - but having this built in/part of the tooling is nice - one less dependency - bash isn't as ubiquitous as you assume.
- btown 8mo agoAs a note here, there are a lot of resources that make bash seem incredibly arcane, with custom functions often recommended. But a simple interruptible script to run things in parallel can be as simple as: (trap 'kill 0' INT TERM; cmd1 & cmd2 & cmd3 & wait) Or, for 1+2 sequentially, in parallel with 3+4 sequentially: (trap 'kill 0' INT TERM; (cmd1 && cmd2) & (cmd3 && cmd4) & wait ) (To oversimplify: The trap propagates the signal (with 'kill') to the process group 0 made by the () parens; this only needs to be set at the top level. & means run in background, && means run and continue only on success.) There are other reasons one might not want to depend on bash, but it's not something to be afraid of!