Live data from Hacker News

Cash: a cross-platform implementation of Unix shell commands in JavaScript

github.com

71–75 of 75 posts

Re: Cash: a cross-platform implementation of Unix shell commands in JavaScript

#71

Earlier quoted context omitted.

mintty comes with cygwin and msys2. It's the one I use. Other people have recommended other terminal emulators like ConEmu, but those have varying (subpar) levels of Unicode/color support.

I also use mintty. It's not great, but I haven't seen anything better (it seems that ConEmu is optimized for cmd.exe, not bash). I'm really using `tmux` inside `mintty` so I have an emulation of tabs inside one terminal. It's not super-convinient, requires the user to setup his/her own .tmux.rc, but it gets the job done (still orders of magnitude better than cmd.exe or "even" powershell).

ConEmu "is optimized" for Windows. The problem is that cygwin is not optimized for Windows.

But there is cygwin connector: https://conemu.github.io/en/CygwinMsysConnector.html

Re: Cash: a cross-platform implementation of Unix shell commands in JavaScript

#72
post #34

Earlier quoted context omitted.

Well if Cygwin weren't a terrible mess, maybe we'd be using it more? It's universally reviled by most folks actually on the Windows platform. The value of this is that it works easily, portably, and with minimal overhead. By bigger question is, why does posix sh deserve to win? It's plaintext pipes approach is really frustrating in 2016.

> why does posix sh deserve to win? It's plaintext pipes approach is really frustrating in 2016. I think that in many aspects plaintext has won. Many historical records of the last century will be or have already been lost, because of formats that nobody can read. OTOH, plaintext is readable and supported by almost everything under the sun.

I think it is weird that people say "plaintext has won" when basically every data format under the sun is structured, no one keeps data unencrypted, and transport protocols have basically grabbed all the mindshare as storage protocols.

But keep in mind I think it is bad for pipes only.

Re: Cash: a cross-platform implementation of Unix shell commands in JavaScript

#73
post #27

But they are not written in cool languages therefore should be rewritten :( In all seriousness, I am struggling a bit to see a point in porting everything to JS (beyond a weekend project because why not, let's learn something). I might be a bit out of the loop since it's been a while that I worked on Windows (and have been using msys2 instead of cygwin back then), but how come DDL and native compiling are the issues…

Porting existig software to JS is advantageous for a few reasons.

NPM makes cross-platform installation simple, easy, and scriptable by default.

Dependency management. The package manager supports both local and global installations, as well as the ability to manage multiple versions of a dependency where necessary. Not by convention, by default. Dependency hell simply isn't an issue in the JS ecosystem.

More secure. Scipt installation/management doesn't require root privileges. The runtime uses it's own sandbox. No matter how safe the underlying OS is, it's virtually impossible for a malicious script to break out and mutate memory/data outside of it's context. PwnToOwn competitions are frequently held to test, identify, and harden security.

Project hosting is trivial to setup. Package installation, upgrade, removal is supported by default.

Scripts aren't tightly coupled to the OS. So you don't have to import the entire universe to use them. For example, Cygwin or MiniGW not required.

Scripts don't require compilation. If you run into problems, it's trivial to open up the source and correct the issue yourself. Shorter iteration/feedback loops on OSS projects means more users are capable of contributing fixes and/or new features.

In short, all of the pain points that suck about native application development have been solved in the JS ecosystem.

Just the 'import the universe' point alone is enough to deter any dane dev from porting a *nix binary to Windows. Disk space isn't the concern, surface area for potential security issues, bugs, and the maintenance overhead of keeping an OS emulation layer updated are.

Javascript is a truly cross-platform solution.

Re: Cash: a cross-platform implementation of Unix shell commands in JavaScript

#74
post #48

well you are just replacing your dependency from cygwin to node.js think of it, what is the utility to implement shell commands in a cross-platform way ? only for Windows You don't need an ES6 implementation of `ls` on Linux and Mac OS X, the tools are already there and yeah they are "ugly" compiled to native executable, but it is exactly what you want for shell commands so you are basically trying to solve a Windows…

V8 is a runtime.

Cygwin is an entire OS ecosystem of dependencies, tools, libraries. POSIX utilities are so tightly coupled to the OS, it's virtually impossible to use them with any degree of confidence without importing the entire universe. There's nothing 'perfectly normal' about such a poorly structured architecture.

JS dependencies are explicitly defined in a package's package.json so it's trivial to track a package's dependencies.

Likewise, one could create a powershell implementation in JS and -- barring windows-specific features -- Powershell scripts would 'just work' in a nix environment as well.

This package makes it trivial to port POSIX tools to Windows. What about greenfield development of utilities that need to work in both nix and Windows? Instead of building for one platform first then porting it to another (incl all the maintenance issues involved in maintaining separate forks in sync) why not use a truly cross-platform language from the start?

The Javascript ecosystem comes with it's own package management system.

Apt-get attempts to be 'everything to everybody'. It requires a monumental effort from the OSS community to maintain the different sources. Outdated packages are the norm making it harder for software maintainers to resolve bugs. Submitting new packages or publishing new versions of existing packages is a PITA. Etc...

NPM's source is centralized and provides a very useful online portal for: searching for packages by keyword and/or tags; publishing the Readme ad human-readable HTML (ie via Markdown); finding related links to the source control, issues, project pages; tracking downloads and development progress stats.

If you prefer not to publish to NPM the NPM directory, packages can be installed directly from GitHub, Bitbucket, etc.

Tapping the broader exosystem is easy for both users and developers.

Re: Cash: a cross-platform implementation of Unix shell commands in JavaScript

#75
post #50

Earlier quoted context omitted.

Well if Cygwin weren't a terrible mess, maybe we'd be using it more? It's universally reviled by most folks actually on the Windows platform. The value of this is that it works easily, portably, and with minimal overhead. By bigger question is, why does posix sh deserve to win? It's plaintext pipes approach is really frustrating in 2016.

I have no problems with powershell wanting to pipe "objects" but I still want a POSIX environment under Windows. And about why POSIX deserve to win ? For me it's about cross-platform command-line, I need to be able to run command-line tools that just behave the same under Windows, Mac OS X and Linux. So far, Windows has ignored the command-line for years, and when they don't ignore it they change it every couple of y…

> For me it's about cross-platform command-line, I need to be able to run command-line tools that just behave the same under Windows, Mac OS X and Linux

Then join my headache world of all 3 versions of bash doing subtly different things. We used to think our automation/deploy scripting could be cross platform if we used bash. Oh what heady and foolish days those were.

Post reply on HN