Fixes issue #62

This commit is contained in:
Petr Bouianov 2014-04-17 19:22:20 -04:00
parent 073fe45223
commit bdd4b5c9fe
2 changed files with 17 additions and 1 deletions

View File

@ -68,6 +68,12 @@ define(function(require) {
SUPER_NODE_ID: '00000000-0000-0000-0000-000000000000',
//Reserved FileDescriptors for streams
STDIN: 0,
STDOUT: 1,
STDERR: 2,
FIRST_DESCRIPTOR: 3,
ENVIRONMENT: {
TMP: '/tmp',
PATH: ''

View File

@ -19,6 +19,11 @@ define(function(require) {
var FSWatcher = require('src/fs-watcher');
var Errors = require('src/errors');
var STDIN = require('src/constants').STDIN;
var STDOUT = require('src/constants').STDOUT;
var STDERR = require('src/constants').STDERR;
var FD = require('src/constants').FIRST_DESCRIPTOR;
// The core fs operations live on impl
var impl = require('src/filesystem/implementation');
@ -74,10 +79,15 @@ define(function(require) {
fs.name = name;
fs.error = null;
fs.stdin = STDIN;
fs.stdout = STDOUT;
fs.stderr = STDERR;
fs.firstFD = FD;
// Safely expose the list of open files and file
// descriptor management functions
var openFiles = {};
var nextDescriptor = 1;
var nextDescriptor = 3;
Object.defineProperty(this, "openFiles", {
get: function() { return openFiles; }
});