The fs.readFile bug was hiding another bug that was causing this test
to pass, even so it was broken:
require.async("../fixtures/throws_error1") in test-module-loading.js
This patch fixes the original test by running _compile within a
try..catch block for _loadScript.
_loadScriptSync also had some useless (deprecated?) code for dealing
with module entry point exceptions. This code was also removed for
greater clarity.
fs.readFile was executing a callback in a try..catch context, which is
a problem in itself. To make matters worse, it would re-execute the
same callback if there was an execution.
This patch fixes both of these problems.
a) create a layer of indirection in net.Stream to allow swapping in
different read/write implementations and
b) emit an 'fd' event when file descriptors are received over a UNIX pipe,
as finally as a tangential benefit
c) remove a bunch of conditionals from the primary codepaths for
ease-of-reading.
Notes:
- Currently only accepts numeric user and group ids.
- No tests, as tests depend on getpwuid and getgrgid.
- No documentation, as there is no tests and this is experimental.
This patch makes buffers the preferred output for fs.read() and
fs.readSync(). The old string interface is still supported by
converting buffers to strings dynamically. This allows to remove the
C++ code for string handling which is also part of this patch.
This patch makes buffers the preferred output for fs.read() and
fs.readSync(). The old string interface is still supported by
converting buffers to strings dynamically. This allows to remove the
C++ code for string handling which is also part of this patch.
There is a difference between errors which happen to a socket - like
receiving EPIPE - an exceptional situation but ultimately okay and the
situation where code throws in a callback - which is not okay.
Fixes test/simple/test-http-exceptions.js
TODO: explain this in docs.
Previously path.dirname('/tmp') incorrectly returned '.'.
Unfortunately module.js incorrectly thinks dirname('/a/b/') should
yield '/a/b', so I can't strip trailing slashes yet. Once module.js
is fixed, then the commented-out code should be activated and a test
written for it.
This patch makes buffers the preferred input for fs.write() and
fs.writeSync(). The old string interface is still supported by
converting strings to buffers dynamically. This allows to remove the
C++ code for string handling which is also part of this patch.
Taking a performance hit on 'hello world' benchmark by enabling this by
default, but I think it's worth it. Hopefully we can improve performance by
resetting the timeout less often - ideally a 'hello world' benchmark would
only touch the one timer once - if it runs in less than 2 seconds. The rest
should be just link list manipulations.
- setTimeout should active the timeout too. (test-net-set-timeout tests
this.)
- 'timeout' event is not automatically followed by an 'error' event. That
is the user is now responsible for destroying the stream if there is an
idle timeout.
- No more single line "node.js:176:9" errors
- No more strange output when error happens on first line due to
module wrapper function.
- A few tests to check these things