Commit Graph

89 Commits (36f3bc33a399fe5839310cf54902d67a63afd6ba)

Author SHA1 Message Date
Ryan Dahl 57890465bd A few more node->process changes 2009-10-30 05:49:23 +01:00
Ryan Dahl ad0a4cefb8 Namespace EVERYTHING under process; introduce GLOBAL
http://groups.google.com/group/nodejs/browse_thread/thread/1034fd2ad2cd93e8
2009-10-29 23:36:41 +01:00
Felix Geisendörfer 659954d842 The return of Promise.cancel() with some additional tests & docs 2009-10-29 11:24:08 +01:00
Ryan Dahl c536728335 Move node.dns.* into /dns.js 2009-10-28 23:02:52 +01:00
Ryan Dahl 3d8b14e6f7 node.fs.* moved into "/posix.js"
use require("/posix.js") to access them.
2009-10-28 22:45:46 +01:00
Ryan Dahl efe34f5023 Only allow a promise to fire once, remove promise.cancel()
promise.cancel() is due to return at some point.
2009-10-28 15:37:03 +01:00
Ryan Dahl 04e53cab90 Rename node.libraryPaths to require.paths
to be more inline with CommonJS.
2009-10-25 22:51:57 +01:00
Ryan Dahl b893859c34 Upgrade http parser, change node as needed.
The latest version of http-parser is a bit more stringent EOF semantics.
2009-10-15 19:18:18 +02:00
Ryan Dahl 3456a16f71 Accept string representations of signals in node.kill and child.kill 2009-10-15 15:45:04 +02:00
Brandon Beacher 334d56d2be Added external interface for signal handlers.
Also process.pid and node.kill().
2009-10-15 14:40:52 +02:00
Connor Dunn 2dbd0d3806 Add node.fs.sendfile() 2009-10-14 18:51:23 +02:00
Felix Geisendörfer 0dbf2d7792 Implemented Promise.timeout() and Promise.cancel() 2009-10-12 16:17:42 +02:00
Ryan Dahl f623fd7658 Normalize HTTP headers.
"Content-Length" becomes "content-length".
2009-10-07 16:56:19 +02:00
Ryan Dahl b76d853f0d Fix test-signal-handler.js on macintosh - pause before exit. 2009-10-07 15:39:39 +02:00
Felix Geisendörfer abbc624f52 Multipart test now uses a fixture instead of CURL 2009-10-07 02:03:24 +02:00
Brandon Beacher f068251494 Added signal handler.
To be used internally. Needs an exposed interface.
2009-10-07 01:23:29 +02:00
Ryan Dahl 82465fc4b1 Do not use /bin/sh to create child processes.
Instead directly call execvp(). This change is needed for the
soon-to-be-added signal handlers because the /bin/sh parent process does not
pass all signals to it's children, particularly SIGUSR1 on Linux.

The parameters of createChildProcess had to be changed slightly.
utils.exec() also has a changed implementation. A bug involving quoted
arguments was knowingly introduced into utils.exec(). Will fix later.
2009-10-07 01:08:33 +02:00
Ryan Dahl 8185e1fd25 Remove include() add node.mixin()
include() should not be used by libraries because it will pollute the global
namespace. To discourage this behavior and bring Node more in-line with
the current CommonJS module system, include() is removed.

Small scripts like unit tests often times do want to pollute the global
namespace for ease. To avoid the boiler plate code of

  var x = require("/x.js");
  var foo = x.foo;
  var bar = x.bar;

The function node.mixin() is stolen from jQuery's jQuery.extend. So that it
can be written:

  node.mixin(require("/x.js"));

Reference:
http://docs.jquery.com/Utilities/jQuery.extend
http://groups.google.com/group/nodejs/browse_thread/thread/f9ac83e5c11e7e87
2009-10-05 15:46:31 +02:00
Ryan Dahl 522909bcbf Parse queryString into req.uri.params 2009-10-05 14:52:26 +02:00
Ryan Dahl a8c0211e73 Bugfix: require() and include() should work in callbacks.
Removing requireAsync and includeAsync from global scope for now as a
temporary fix.  Reported by Yuffster.
2009-09-29 19:28:54 +02:00
Ryan Dahl 095470854b Move tcp library to /tcp.js 2009-09-28 18:48:18 +02:00
Ryan Dahl f6657c3c9d Move http library to /http.js 2009-09-28 12:36:36 +02:00
Ryan Dahl 7abad8b7b3 API: Move node.puts(), node.exec() and others to /utils.js 2009-09-28 12:06:30 +02:00
Felix Geisendörfer 27c750154e Multipart stream parser 2009-09-27 16:58:56 +02:00
Ryan Dahl 106287c368 Tighten window on timer test. 2009-09-23 16:40:04 +02:00
Ryan Dahl e0ec0036ca Add connection.setNoDelay() to disable Nagle algorithm. 2009-09-23 15:36:34 +02:00
Ryan Dahl 07792afe0a Remove "raw" encoding. Rename "raws" to "binary".
Deprecation warnings have been added to help the conversion to this new API.
2009-09-21 12:27:22 +02:00
Ryan Dahl cd70d4a9c0 Add "/file.js" buffered disk I/O object.
This is similar to the class node.File which was removed in
82cb1b5acb.

Needs documentation.
2009-09-20 20:42:23 +02:00
Ryan Dahl 4b8f503fac Move mjsunit.js to system module directory. 2009-09-20 18:19:33 +02:00
Ryan Dahl c8b143bf30 Absolute path names for require() refer to node.libraryPaths 2009-09-19 17:21:12 +02:00
Jon Crosby e57c16bc2d Add failing spec for node.fs.write 2009-09-17 14:58:01 +02:00
Ryan Dahl 083d150bc4 Add node.exec() 2009-09-15 15:42:16 +02:00
Ryan dbe116ddfe API: Change arguments of emit(), emitSuccess(), emitError()
Instead of

  myemitter.emit("event", [arg1, arg2, arg3]);

the API is now

  myemitter.emit("event", arg1, arg2, arg3);

This change saves the creation of an extra array object for each event.
The implementation is also slightly more simple.
2009-09-12 14:21:37 +02:00
Ryan 241950c1df Add isDirectory(), isFile(), isSocket(), ... methods to stats object.
Thanks to Felix Geisendörfer for the initial patch.
2009-09-11 13:41:47 +02:00
Ryan 8890070b88 Introduce "raws" encoding. Raw String.
This allows you to have binary data imported into your application via
strings instead of arrays of numbers! This needs testing before release.
2009-09-09 17:22:20 +02:00
Ryan 1a2696f10a Almost completely remove onExit and onLoad.
They were deprecated in 723c7d9f7c and
31265be4a6.

Still retaining error message.
2009-09-07 14:45:48 +02:00
Ryan 9dbd92476e Bugfix: Trap exceptions in URIParser.
A user was able to crash chat.tinyclouds.org by sending it a malformed URL!
Not good.
2009-09-04 17:42:00 +02:00
Ryan 1bd5277233 Add test-mkdir-rmdir.js 2009-09-04 11:46:31 +02:00
Ryan b6eed30379 Sort files in readdir test. 2009-09-03 21:59:31 +02:00
Ryan 9b3e2ae192 Add node.fs.readdir() 2009-09-03 21:32:27 +02:00
Ryan aefbd57514 Add stack to promise.wait().
The problem was that if promise A was waiting and promise B was created and
then also told to wait (from some callback coming off the event loop), and
then promise A finished, promise B's wait would return. Promise A's wait
would not return until promise B was finished. This is incorrect.

To solve this issue properly, one probably needs to allocate separate
execution stacks. I use, instead, Poor Man's Coroutines. We continue to use
the main execution stack and force promises created most recently to return
first.

That is even if Promise A finishes first, neither wait() returns. Not until
Promise B finishes, will its wait() return. After that is complete, Promise
A's wait() will return.

This introduces the problem of growing the "wait stack" infinitely. Thus
I've added a strong warning to the documentation only to use this operation
sparingly. require() and include() seem to be the proper use case for such a
thing: they are called usually at program start up - they don't take too
long to finish and they won't be called so often.

Let's experiment with this stop-gap. If the infinite promise stack becomes a
problem for many, then I will remove promise.wait() entirely or perhaps only
use it for thread pool events.
2009-09-03 10:48:39 +02:00
Ryan afd9e714d3 Stack traces for mjsunit errors, better error reporting function.
The error reporting function tries to look at the "stack" element of the
exception.
2009-08-31 18:42:50 +02:00
Ryan 7beea2cd5f Upgrade evcom; Add setTimeout method to node.tcp.Connection
The default timeout is 60 seconds, but it can now be changed.

evcom upgrade includes fixes to force_close.
2009-08-31 18:26:50 +02:00
Ryan ad9d683f9f API: rename node.Process to node.ChildProcess
This is to avoid confusion with the global "process" object, especially for
the instances of node.Process.
2009-08-26 22:36:45 +02:00
Ryan 116f4dea05 lint 2009-08-26 22:14:45 +02:00
Ryan 723c7d9f7c Replace onExit() with process.addListener("exit")
- Update documentation.

- Depreciation message for onExit().
2009-08-26 22:14:44 +02:00
Ryan 31265be4a6 Depreciate onLoad 2009-08-26 22:14:44 +02:00
Ryan 18d0511777 promise.block() renamed to promise.wait()
promise.wait() now returns the arguments of the "success" event.  If there
was only a single argument, then it is returned.  If there was more than
one, they are returned as an array.  If there was an error, it is thrown.
See documentation.
2009-08-26 17:28:49 +02:00
Ryan db42ad959d API: All EventEmitters emit "newListener" when listeners are added.
The "newListener" event will also be emitted for listeners to "newListener".
Maybe useful?
2009-08-25 17:28:06 +02:00
Ryan 19f182a39f Experimental support for Promise.block() 2009-08-25 04:25:35 +02:00