gvarsanyi / sync-exec

node/npm module to imitate fs.execSync
MIT License
39 stars 14 forks source link

[Error: spawn EMFILE] #16

Open maxnikulin opened 8 years ago

maxnikulin commented 8 years ago

It seems that I have faced file descriptor leak in sync-exec

var syncExec = require('sync-exec');
var i = 0;
try {
    for (; i < 1000; ++i) {
        syncExec("echo 1");
    }
} catch (e) {
    console.log(i, e);
}
336 { [Error: spawn EMFILE] code: 'EMFILE', errno: 'EMFILE', syscall: 'spawn' }

Sometimes the script hangs on the first iteration.

node -v: v0.10.25 OS: Linux