Commit Graph

590 Commits

Author SHA1 Message Date
Ben Noordhuis
786e1e8712 buffer, crypto: fix buffer decoding
Before this commit, DecodeWrite() mistakenly tried to convert buffers to
UTF-8 strings which:

  a) produced invalid character sequences when the buffer contained
     octets > 127, and
  b) lead to spurious test failures because DecodeWrite() wrote less bytes
     than DecodeBytes() said it would, with the remainder either containing
     zeros or garbage

Fix that by simply copying the buffer's data to the target buffer when the
encoding is BINARY or by converting the buffer to a binary string when it's
UTF8 or ASCII.

Fixes #3651, #3866.
2012-08-14 23:00:09 +02:00
isaacs
b3cf3f35fc Report errors properly from --eval and stdin 2012-07-30 08:21:39 -07:00
Peter Rybin
688859afc0 debugger: wake up the event loop when a debugger command is dispatched
When the event loop was blocked in epoll / kqueue or similar, debugger
commands wouldn't be processed. This patch fixes that by adding an
uv_async handle which is triggered when a debugger command is
dispatched. The async handle's callback makes sure that V8 is entered.

Closes GH-3626
Closes GH-3718
2012-07-23 13:15:51 +02:00
Nathan Rajlich
d3d83d7b90 process: throw a TypeError when anything but an Array is passed to hrtime()
Fixes #3664.
2012-07-08 20:53:19 -07:00
isaacs
48c3d20041 Apply --no-deprecation to C++ warnings as well 2012-06-21 12:29:33 -07:00
isaacs
5b39929d47 Add --no-deprecation and --trace-deprecation flags 2012-06-21 12:05:33 -07:00
Ben Noordhuis
f0ce98441f fs: make fs.watchFile() work on windows 2012-06-21 03:05:18 +02:00
Trent Mick
196207c228 node: remove unused flags and files
Drop vestigial `process.installPrefix`, `node --vars`, NODE_CFLAGS and
NODE_PREFIX.

Also removed unused node_config.h.in (replaced with config.gypi a while back).
2012-06-18 23:56:42 +02:00
Andreas Madsen
6d70a4ae16 node: change the constructor name of process from EventEmitter to process 2012-06-17 13:14:11 -07:00
Igor Zinkovsky
39d2337859 Windows: don't fire GC ETW events without ETW consumers 2012-06-14 15:26:47 +02:00
Bert Belder
09be360a0f Inherited FDs should not accidentally be inherited by child processes
This makes test-child-process-detached pass on Windows.
2012-06-14 01:28:51 +02:00
Igor Zinkovsky
35a1421e96 Windows: Enable ETW events.
This commit enables ETW events to be fired on Windows for existing
DTrace probes.  ETW instrumentation is enabled by default.  It
is possible to build node.exe without ETW instrumentation by
using --without-etw option with configure script.
2012-06-13 15:36:08 -07:00
Ben Noordhuis
039fac633e deps: upgrade libuv to a478847
The event loop's reference counting scheme in this version of libuv has changed.
Update the libuv bindings to reflect that fact.
2012-05-22 16:14:24 +02:00
Oleg Efimov
968b49ba0a Check for tabs in source line in DisplayExceptionLine
Fix for joyent/node#3280
2012-05-21 18:30:16 +02:00
isaacs
a3753b496e Revert "Fix #3242 Actually deprecate 'binary' buffer encoding"
This reverts commit 5979f096d1.

Related:
- #3279
- #3278
2012-05-16 16:32:37 -07:00
isaacs
643f00d3f9 Merge branch 'master' into v0.6-merge
Conflicts:
	src/node.cc
2012-05-15 14:21:22 -07:00
Ben Noordhuis
e813e3491e node: make _getActiveHandles() return user objects
Before this commit, process._getActiveHandles() returned a list of internal
handles. Now, it returns the user objects that handles are attached to.

For example, a tcp_wrap handle will now return its parent net.Socket object.

It works for all handle types except timers because timer handles are shared
across multiple user objects.
2012-05-15 21:01:36 +02:00
Ben Noordhuis
5f0406534c process: add _getActiveHandles(), _getActiveRequests()
* process._getActiveHandles() returns a list containing all active handles
  (timers, sockets, etc.) that have not been unref'd.

* process._getActiveRequests() returns a list of active requests (in-flight
  actions like connecting to a remote host, writing data to a socket, etc.).
2012-05-15 21:00:27 +02:00
Ben Noordhuis
636add246c req_wrap: share process_symbol, domain_symbol
Share persistent strings process_symbol and domain_symbol across compilation
units. Avoids redefinition errors when src/node.cc includes src/req_wrap.h.
2012-05-15 20:59:43 +02:00
isaacs
07be9fc3a6 Merge remote-tracking branch 'ry/v0.6' into v0.6-merge
Conflicts:
	Makefile
	lib/zlib.js
	src/node.cc
	src/node.js
2012-05-09 15:12:13 -07:00
Felix Geisendörfer
814033365b Fix process.nextTick throw call sites
This patch now reports the proper throw call site for exceptions
triggered within process.nextTick. So instead of this:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^

You will now see:

mydir/myscript.js:15
  throw new Error('My Error');
          ^

From my testing this patch causes no performance regressions, but does
greatly simplify processing the nextTickQueue.
2012-05-09 11:54:43 -07:00
isaacs
5979f096d1 Fix #3242 Actually deprecate 'binary' buffer encoding 2012-05-09 10:08:54 -07:00
Ben Noordhuis
78e831a31c Don't use _snprintf() on Windows, it's not safe.
_snprintf() doesn't zero-terminate the buffer on overflow. Use the hand-rolled
version that lives in src/node_internals.h.
2012-05-08 16:02:14 +02:00
Marcel Laverdet
c33d3174b8 node: un-revert 9a6012e
The crashes in debug mode after adding Locker are *not* caused by
Locker. Locker is merely exposing issues that already existed. Some of
these issues have since been fixed in 70635753.

This reverts commit 407181538b.
This reapplies commit 9a6012edd9.

Conflicts:
	src/node.cc
2012-05-05 00:56:17 +02:00
Ben Noordhuis
e4a8d2617b addon: add AtExit() function
Lets native addons register exit hooks that run after the event loop has quit
but before the VM is killed.

Fixes #3147.
2012-05-03 16:11:42 +02:00
Nathan Rajlich
b894521bd2 process: ensure that "exit" doesn't get emitted twice on a natural exit
Fixes "test/simple/test-process-exit.js".
2012-05-01 14:09:31 -07:00
Nathan Rajlich
248f552ab4 process: ensure that the "exit" event always has "code" given
Upon "normal" exiting of Node (i.e. the event loop completes naturally),
the "code" parameter was not being passed to the "exit" event listeners.

Be consistent. Tests included.
2012-04-30 10:42:13 -07:00
Ben Noordhuis
5648d95c4a Remove unused local variable. 2012-04-25 04:10:31 -07:00
Nathan Rajlich
6292df659f process: comment for consistency 2012-04-24 11:31:26 -07:00
Nathan Rajlich
ef3a874f41 process: set _print_eval even when --eval is not passed
This is for scripts being fed from stdin:

  $ echo "{ foo: 'bar' }" | node -p
2012-04-24 11:31:02 -07:00
isaacs
10ce3d129d Domain hooks in ReqWrap<T> and MakeCallback 2012-04-17 13:14:55 -07:00
isaacs
a26bee8fa1 MakeCallback: Consistent symbol usage 2012-04-17 13:14:54 -07:00
isaacs
88f94fa28c MakeCallback: abort() if not a function 2012-04-17 12:00:58 -07:00
isaacs
ac1aaddc00 MakeCallback: Return the callback return value 2012-04-17 11:56:33 -07:00
isaacs
7407be896e MakeCallback: Accept Function or Symbol argument 2012-04-17 11:56:32 -07:00
isaacs
80a55e9c83 Report errors thrown from uncaughtException handers 2012-04-17 11:56:32 -07:00
Ben Noordhuis
3f4261276e node: don't check return value of unsetenv()
It returns void on some platforms, notably FreeBSD.
2012-04-16 14:16:48 +02:00
Ben Noordhuis
dee8c51547 node: don't check return value of unsetenv()
It returns void on some platforms, notably FreeBSD.
2012-03-31 23:23:48 +02:00
Bert Belder
407181538b Revert "Re-add top-level v8::Locker"
The locker makes node crash in debug mode sometimes.
For example, test/simple/test-repl.js triggers it.

This reverts commit 9a6012edd9.

Conflicts:

	src/node.cc
2012-03-30 21:50:15 +02:00
Ben Noordhuis
db0a1dc7d9 node: remove unused function 2012-03-30 14:52:39 +02:00
Ben Noordhuis
8c97ad4c30 node: fix signedness compiler warnings 2012-03-30 14:52:38 +02:00
Fedor Indutny
5e8c2b0768 debugger: use v8 api to wait for a connection
Use v8::Debug::EnableAgent(_, _, true) to wait for incoming
debugger-client connection before emitting any break (or other) events.

This commit should fix test/simple/test-debugger-repl faults.
2012-03-28 01:37:54 +07:00
ssuda
249c3c165a Avoiding unnecessary ToString() calls
String::Utf8Value and String::AsciiValue constructors take Handle<Value>
So no need to convert to Handle<String>
2012-03-23 01:02:59 +01:00
Nathan Rajlich
feaa8a41c7 cmd: add a -i / --interactive flag to force the REPL
This is the only way to spawn a node child process in REPL mode, and will
also be needed to be able to use the REPL in MinTTY.
2012-03-21 00:05:25 -07:00
Ben Noordhuis
1a97998644 process: fix process.title setter
Commit 19fd530 broke the argv initialization logic that's used on linux and
freebsd to update the process name (as displayed in tools like `top`).

Fixes test/simple/test-setproctitle.js.
2012-03-15 23:10:32 +01:00
Micheil Smith
19fd5301bf Expose original argv as process.execArgv for cluster and child_process.fork() 2012-03-15 13:47:43 -07:00
Nathan Rajlich
35043ad8ac process: use NODE_STRINGIFY macro to set process.versions.uv 2012-03-14 01:40:29 +01:00
Nathan Rajlich
9701f1c4b2 process: expose the zlib version in use in process.versions 2012-03-12 23:29:20 +01:00
Nathan Rajlich
36761b2055 process: expose the http_parser version in process.versions 2012-03-10 00:22:42 +01:00
Ben Noordhuis
ff4a9d381d core: use proper #include directives 2012-03-10 00:14:14 +01:00