shelljs / shx

Portable Shell Commands for Node
MIT License
1.72k stars 44 forks source link

"shx cp" does not finish on Unix-Systems #95

Closed yvo-niedrich closed 7 years ago

yvo-niedrich commented 7 years ago

The following command is part of my "postinstall"-routine in package.json:

shx cp node_modules/react/dist/react.min.js node_modules/react-dom/dist/react-dom.min.js node_modules/three/build/three.min.js app/static/

With v0.1.4 everything is working fine, but after updating my dependencies (shx v0.2.0) npm install would not finish on travis or my buddies OSX; while i had no trouble running the script on windows.


Edit: package.json and other stuff can be found here

nfischer commented 7 years ago

Hmmm this is strange. I'll investigate sometime this week.

Does the command work if you install shx globally?

yvo-niedrich commented 7 years ago

I just fetched the repo on my own mac und everything is working fine with shx 0.2.0 (global and local).

It seems to be something strange in combination with the maven build environment. I'll setup maven tomorrow and have post my findings...

nfischer commented 7 years ago

@Ungolianth thanks for investigating. If we can pinpoint the issue of this, I would be interested in working on a workaround or a fix. Let me know if I can of help during the investigation.

nfischer commented 7 years ago

Looks like we're already testing cp. If there's a way we can better test this, feel free to send a PR.

nfischer commented 7 years ago

Hmmm... I'm running into this issue on my local machine now. It seems to be any command that isn't receiving piped input.

I see an issue when I run

> shell.exec('shx ls');

This is possibly a regression caused by #89.

nfischer commented 7 years ago

It looks like process.stdin.isTTY doesn't always work exactly how we want. We should look carefully for a good alternative. Ideally, we want a way to read all of stdin, or throw an exception if stdin is not being written to.

nfischer commented 7 years ago

After thinking about this for a bit, the best quick-fix I can come up with is this:

This approach should prevent issues like what we're seeing here, at least until we can find a more suitable alternative for process.stdin.isTTY.

I'll have this out in v0.2.1 this week.

bhousel commented 7 years ago

I noticed that shx is just hanging under Cygwin and git bash shell for Windows. Is this the same issue?

nfischer commented 7 years ago

@bhousel #98 should fix this. Feel free to leave comments on it if you see any issues, otherwise I'll release it tonight as a patch

bhousel commented 7 years ago

Feel free to leave comments on it if you see any issues, otherwise I'll release it tonight as a patch

Thanks for the quick fix! I can confirm 0.2.1 is working great 👍