mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
5f2e90934e
This allows the various fs utilities and process.umask to be used in ECMAScript 5 Strict Mode, where the octal literal format is verboten, without requiring users to litter their code with a bunch of parseInt calls.
28 lines
628 B
JavaScript
28 lines
628 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
var path = require('path');
|
|
var fs = require('fs');
|
|
var got_error = false;
|
|
var success_count = 0;
|
|
|
|
var file = path.join(common.fixturesDir, 'a.js');
|
|
|
|
fs.chmod(file, '0777', function(err) {
|
|
if (err) {
|
|
got_error = true;
|
|
} else {
|
|
console.log(fs.statSync(file).mode);
|
|
assert.equal(0777, fs.statSync(file).mode & 0777);
|
|
|
|
fs.chmodSync(file, 0644);
|
|
assert.equal(0644, fs.statSync(file).mode & 0777);
|
|
success_count++;
|
|
}
|
|
});
|
|
|
|
process.addListener('exit', function() {
|
|
assert.equal(1, success_count);
|
|
assert.equal(false, got_error);
|
|
});
|
|
|