`function (exception) { }`
-Emitted on error with the exception `e`.
+Emitted on error with the exception `exception`.
### Event: 'close'
### Event: 'exit'
-`function () {} `
+`function () {}`
Emitted when the process is about to exit. This is a good hook to perform
constant time checks of the module's state (like for unit tests). The main
### Event: 'uncaughtException'
-`function (err) { } `
+`function (err) { }`
Emitted when an exception bubbles all the way back to the event loop. If a
listener is added for this exception, the default action (which is to print
}, 500);
// Intentionally cause an exception, but don't catch it.
- nonexistantFunc();
+ nonexistentFunc();
sys.puts('This will not run.');
Note that `uncaughtException` is a very crude mechanism for exception
oldmask, newmask = 0644;
oldmask = process.umask(newmask);
- // these octal numbers don't display right in JavaScript
- sys.puts('Changed umask from: ' + oldmask + ' to ' + newmask);
+ sys.puts('Changed umask from: ' + oldmask.toString(8) +
+ ' to ' + newmask.toString(8));
### sys.puts(string)
-Outputs `string` and a trailing new-line to `stdout`.
+Outputs `string` and a trailing newline to `stdout`.
require('sys').puts('String with a newline');
### sys.print(string)
-Like `puts()` but without the trailing new-line.
+Like `puts()` but without the trailing newline.
require('sys').print('String with no newline');
### Event: 'exit'
-`function (code, signal) {} `
+`function (code, signal) {}`
This event is emitted after the child process ends. If the process terminated
normally, `code` is the final exit code of the process, otherwise `null`. If
After this event is emitted, the `'output'` and `'error'` callbacks will no
longer be made.
-See `waitpid(2)`
+See `waitpid(2)`.
### child_process.spawn(command, args, env)
fs.writeFile('message.txt', 'Hello Node', function (err) {
if (err) throw err;
- sys.puts('It's saved!');
+ sys.puts('It\'s saved!');
});
### fs.writeFileSync(filename, data, encoding='utf8')
### readStream.readable
A boolean that is `true` by default, but turns `false` after an `'error'`
-occured, the stream came to an 'end', or `destroy()` was called.
+occured, the stream came to an `'end'`, or `destroy()` was called.
### readStream.pause()