mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
d5ab92bcc1
In the tests, we use "process.platform === 'win32'" in some places. This patch replaces them with the "common.isWindows" for consistency. PR-URL: https://github.com/nodejs/io.js/pull/2269 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
30 lines
691 B
JavaScript
30 lines
691 B
JavaScript
'use strict';
|
|
var common = require('../common');
|
|
var assert = require('assert');
|
|
var spawn = require('child_process').spawn;
|
|
var fs = require('fs');
|
|
|
|
if (common.isWindows) {
|
|
console.log('1..0 # Skipped: no RLIMIT_NOFILE on Windows');
|
|
return;
|
|
}
|
|
|
|
for (;;) {
|
|
try {
|
|
fs.openSync(__filename, 'r');
|
|
} catch (err) {
|
|
assert(err.code === 'EMFILE' || err.code === 'ENFILE');
|
|
break;
|
|
}
|
|
}
|
|
|
|
// Should emit an error, not throw.
|
|
var proc = spawn(process.execPath, ['-e', '0']);
|
|
|
|
proc.on('error', common.mustCall(function(err) {
|
|
assert(err.code === 'EMFILE' || err.code === 'ENFILE');
|
|
}));
|
|
|
|
// 'exit' should not be emitted, the process was never spawned.
|
|
proc.on('exit', assert.fail);
|