6 ms·
ShellJS was a delight to use when we had to build a cross platform Electron-based (sorry) desktop application for Mac and Windows. It replaced batch and shell s
by statico 5y ago
ShellJS was a delight to use when we had to build a cross platform Electron-based (sorry) desktop application for Mac and Windows. It replaced batch and shell scripts, async operations were easy thanks to NodeJS, and the scripts were maintainable. 8/10, would use again.
- nerdponx 5y agoI feel like Node being "async-first" is such an underrated feature, compared to its big competitors (Python, Ruby, Perl). I really don't some of the Javascript quirks, but Node is a great general-purpose scripting tool as a change of pace from Python. Edit: I know we're not supposed to talk about voting on HN, but really? -2 for saying "hey maybe NodeJS is actually kind of OK for some stuff" is wild.
- VWWHFSfQ 5y agoI don't think "async-first" is really all it's cracked up to be. It's great for concurrent I/O (webservers). Not great for writing run-of-the-mill sysadmin scripts like rotating log files, doing file backups, etc. Now instead of just knowing that your cron job is doing something one at a time, suddenly you have all these async things happening and you look at your process table and there's 40 node.js processes trying to compress every log file in the system all at once. And if you don't want it to do that then you have to start managing the concurrency yourself. I've never had to manage concurrency in a shell script beyond just making sure my crons don't run over each other if they take too long.
- nwienert 5y agoYou’re conflating concurrency and parallelism. Unless you’re explicitly forking the process, the async all happens in one process. Async is incredibly easy to manage in node, even the simplest linter handles telling you you’re forgetting to await if you are.
- colordrops 5y agoYou can do it all synchronously in node if you wish. The async gives another dimension to work with.
- hamburglar 5y agoExcept the first two commands I looked at the implementation for were implemented as sync IO calls (and one of them was “cat” which is implemented as a sync read of the entire file).
- canadianfella 5y agoYou’re missing a word. Try fixing that.
- an_opabinia 5y agoOne thing I wish Windows developers did more was bundle Busybox, a 1.6mb binary, to run shell scripts with bashisms, rather than use batch files, powershell or other alternatives. If Microsoft had only put all the PowerShell for Linux resources into Busybox. MSYS2 is also pretty comfy. But that audience is probably better served by running WSL2.
- VWWHFSfQ 5y agoThis reminds me of a web hosting/managed colocation company I worked for back in the early 2000s. They pretty much only had unix sysadmins so basically every windows box got cygwin and activestate perl because it was really the only thing these guys knew how to use. Nobody ever bothered to learn how to script a windows machine. PowerShell was still in its infancy. But nowadays I don't think it's really appropriate to not use the platform-native tools to administer the machine. Imagine installing windows powershell on debian because you don't know how to write unix shell scripts.
- an_opabinia 5y agoPowerShell is so bad though, absolutely zero people do that. PowerShell for Linux is a straight up butt of jokes at Microsoft for having zero DAU.
- Tabular-Iceberg 5y ago> PowerShell is so bad though Care to elaborate? I’m stuck with Windows for bean counting reasons, and though I resent it I feel I would benefit from actually learning to make full use of it. But maybe it’s not worth the trouble?