Comments (12)
Hey sorry I don't have a Debian box to diagnose this -- would love a little help :)
from shelljs.
Ok, so just in case you happen to have a friend running Debian:
sudo apt-get install nodejs
sudo apt-get install npm
npm install shelljs
The lines above still trigger the issue.
strace
tells me that the nodejs
process is stuck in a loop:
stat("/tmp/makerjs_052f088735d88bd935dc", 0x7fff3caf77e8) = -1 ENOENT (No such file or directory)
stat("/tmp/makerjs_aa6976a72a46d46235f9", 0x7fff3caf7798) = -1 ENOENT (No such file or directory)
open("/tmp/makerjs_36651fa5cb9050bc3627", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
pwrite(5, "a", 1, 0) = 1
close(5) = 0
stat("/tmp/makerjs_052f088735d88bd935dc", 0x7fff3caf77e8) = -1 ENOENT (No such file or directory)
stat("/tmp/makerjs_aa6976a72a46d46235f9", 0x7fff3caf7798) = -1 ENOENT (No such file or directory)
open("/tmp/makerjs_36651fa5cb9050bc3627", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
pwrite(5, "a", 1, 0) = 1
close(5) = 0
stat("/tmp/makerjs_052f088735d88bd935dc", 0x7fff3caf77e8) = -1 ENOENT (No such file or directory)
stat("/tmp/makerjs_aa6976a72a46d46235f9", 0x7fff3caf7798) = -1 ENOENT (No such file or directory)
open("/tmp/makerjs_36651fa5cb9050bc3627", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
pwrite(5, "a", 1, 0) = 1
close(5) = 0
stat("/tmp/makerjs_052f088735d88bd935dc", 0x7fff3caf77e8) = -1 ENOENT (No such file or directory)
stat("/tmp/makerjs_aa6976a72a46d46235f9", 0x7fff3caf7798) = -1 ENOENT (No such file or directory)
open("/tmp/makerjs_36651fa5cb9050bc3627", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 5
fcntl(5, F_SETFD, FD_CLOEXEC) = 0
pwrite(5, "a", 1, 0) = 1
close(5)
Let me know if I can do anything else.
from shelljs.
It seems to be a problem with the temporary files created by the execSync
function (this function uses a temp-file monitoring hack to detect when an external process has ended). Perhaps the process doesn't have the right permissions to write to /tmp
?
Here's the relevant part that sets the temp file names: https://github.com/arturadib/shelljs/blob/master/shell.js#L1730-L1734
And here's the part that loops until the temp files are created (i.e. after the external process has finished): https://github.com/arturadib/shelljs/blob/master/shell.js#L1778-L1783
If you have time to narrow down the problem in this execSync
function that'd be superb :)
from shelljs.
I don't think it's a write permission problem; this is my laptop, I can write files to /tmp, and there are indeed a couple makerjs_* files hanging around in /tmp.
I'm not a nodejs hacker (I don't even know where the shelljs files got installed) so I can't promise anything; besides, I've got a deadline for a conference looming, but I may be able to look into this in a couple weeks.
Thanks for the ping!
jonathan
from shelljs.
Forgot to mention that one of the two files is just the single
character "a" while the other one seems to be a well-formed js file.
On Wed 20 Mar 2013 02:32:56 PM CET, Artur Adib wrote:
It seems to be a problem with the temporary files created by the
|execSync| function (this function uses a temp-file monitoring hack to
detect when an external process has ended). Perhaps the process
doesn't have the right permissions to write to |/tmp|?Here's the relevant part that sets the temp file names:
https://github.com/arturadib/shelljs/blob/master/shell.js#L1730-L1734And here's the part that loops until the temp files are created (i.e.
after the external process has finished):
https://github.com/arturadib/shelljs/blob/master/shell.js#L1778-L1783If you have time to narrow down the problem in this |execSync|
function that'd be superb :)—
Reply to this email directly or view it on GitHub
#51 (comment).
from shelljs.
No movement on this? I have the exact same issue. Strace is spitting out:
stat("/tmp/shelljs_9571547baab5cf1a38b3", 0x7fffcb1083f8) = -1 ENOENT (No such file or directory)
open("/tmp/shelljs_5551a876f0699f0863c2", O_WRONLY|O_CREAT|O_TRUNC, 0666) = 11
pwrite(11, "a", 1, 0) = 1
close(11)
over and over, while using 100% CPU.
The files are as follows:
stdoutFile: /tmp/shelljs_ba0d754beae800fb26e6
codeFile: /tmp/shelljs_9571547baab5cf1a38b3
scriptFile: /tmp/shelljs_c8142a779ed3d2169974
sleepFile: /tmp/shelljs_5551a876f0699f0863c2
and the files that exist are:
ll /tmp/shelljs_*
-rw-r--r-- 1 ____ users 0 Jun 25 15:33 /tmp/shelljs_5551a876f0699f0863c2
-rw-r--r-- 1 ____ users 341 Jun 25 15:27 /tmp/shelljs_c8142a779ed3d2169974
So it's the very first busy loop (that checks for codeFile) that is failing.
--- 10 minutes later ---
I got shell.js to spit out the value of process.execPath and it was .../zepto/node_modules/coffee-script/bin/coffee (I am trying to build zepto obviously). This fails with a syntax error trying to run js and the execSync hack gets stuck in a loop.
Manually running "node /tmp/shelljs_c8142a779ed3d2169974" in another terminal got it out of the loop.
I'm not sure if this is improper usage of shelljs by zepto or if shell.js shouldn't rely on process.execPath being "node".
Is this just a workaround for that odd Ubuntu bug where there was another program named node? (#50) and node gets called nodejs?
If that's the only reason I'm not sure this is the right approach, that's a $PATH problem that ubuntu users have. Not that I know what the right answer is here, but the combination of this temp-file hack and trying to fix common path problems in Ubuntu to help your users is a recipe for a lot of corner case problems.
from shelljs.
We just hit this bug over in melonjs/melonJS#528
Wouldn't the busy IO loop be better implemented with fs.watch? My poor CPU...
In any case, we're going to switch to async exec
, and hopefully that will resolve this for us. We'll just have to wrap our commands in an async series. 😒
from shelljs.
we need to implement the fresh new execSync
in Node http://strongloop.com/strongblog/whats-new-in-node-js-v0-12-execsync-a-synchronous-api-for-child-processes/
anyone? =)
from shelljs.
@protz @parasyte @infracanophile Sorry for the delay! Any luck on this? Does the issue persist in shelljs v0.6
? If so, which versions of node are you seeing the issue on?
from shelljs.
@nfischer I have already rewritten my shelljs calls to run asynchronously, and chained them with promises. I could experiment with reverting that.
from shelljs.
@parasyte thanks!
from shelljs.
Closing this, due to lack of inactivity. If this is still an issue, please ping this thread.
from shelljs.
Related Issues (20)
- how to use read -p get user input? HOT 1
- The cd command can report an incorrect error when executing in a worker HOT 2
- shelljs.exec( `date "+%y%m%d.%H%M" ` ) just hangs
- Sudo requesting while using a npm for a GUI
- the code on [npm.js ](https://www.npmjs.com/package/shelljs) is not up-to-date(Compare with [github] HOT 1
- npm WARN EBADENGINE Unsupported engine HOT 5
- Sdtout is empty if using another shell
- Using exec does not terminate the command process HOT 1
- Codecov broken on CI
- Shell.exec() freezes HOT 6
- Feature request (cp): -v flag for verbose output HOT 3
- Feature request (true, false) HOT 1
- test-with-coverage is broken on node v16 HOT 1
- `cd.js` swallows the initial error HOT 1
- "TypeError: common.register is not a function" under node v20.6.0 HOT 13
- GitHub actions dropping support for node < 16
- Exec failure on Node 21 HOT 1
- In mv command, there should be en error if destination directory not present. HOT 1
- shell.exec(`mv a/m.js b/`) cannot return error stdout HOT 2
- Latest shelljs type definitions have errors HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shelljs.