This never worked with node >0.x because of faulty logic determining
`nodeSpawnSupportsStdio` -- attempting to compare with, e.g.,
`Number('v1')`.
Fixes#370
Make the default (long output format, UTC time) for the bunyan CLI a
fast path that doesn't use moment.js. Admittedly I haven't measured
percentage impact of `moment(rec.time).utc().format(...)` for
many bunyan records.
Also make moment dep *optional*. The bunyan CLI will error out without
the moment dep *only if local time is requested.*
Bunyan CLI was not handling timezone conversion properly when set to use
local time. This patch uses [Moment.js][] to fix those issues.
* Timezone conversions work properly across DST conversions
* The timezone, when shown, is correctly shown as `±hh:mm`
* The timzeone is omitted on short output, since it isn't that short.
Except when UTC is used, since that can be indicated by the single
character `Z`
Fixes#245
[Moment.js]: http://momentjs.com/
If an object has a defined property, that is enumerable, and this
property throws an error, it will make JSON stringify throw an
error, and potentially bring down the program.
The solution so far is to try-catch with the usual json stringifyer,
that guards against circular references. If this throws an error
we will attempt to guard against defined properties; and return
[Throws] if a property throws an error when accesed.
The following examples illustrate the problem:
```js
var obj = {};
obj.__defineGetter__('foo', function() { throw new Error('ouch!'); });
JSON.stringify(obj.foo); // error thrown
```
And using `Object.defineProperty`:
```js
var obj = {};
Object.defineProperty(obj, 'foo', {
get: function() { throw new Error('ouch!'); }
enumerable: true // enumerable is false by default
});
JSON.stringify(obj.foo); // error thrown
```
The cases we have seen in production is third party modules that
has enumerable getters that try to access properties on undefined
objects.
Fixes#182.
When the second argument to nodeunit's assert.throws() is a string it
is used as the failure message, not for exception message matching.
To assert the contents of the exception's message a RegExp must be
used.
Change default condition evaluation from vm.runInNewContext to
eval-style functions. Use of "naked" variables (pid === 123, etc) no
longer works, making this.<name> variable qualification necessary.