A few more node->process changes
authorRyan Dahl <ry@tinyclouds.org>
Thu, 29 Oct 2009 22:59:35 +0000 (23:59 +0100)
committerRyan Dahl <ry@tinyclouds.org>
Fri, 30 Oct 2009 04:49:23 +0000 (05:49 +0100)
bin/node-repl
doc/api.txt
test/mjsunit/disabled/test-cat.js
test/mjsunit/disabled/test-http-stress.js
test/mjsunit/disabled/test-remote-module-loading.js
test/mjsunit/disabled/test_dns.js

index 00975dc..e08dee0 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/env node
 
-node.mixin(require("/utils.js"));
+process.mixin(require("/utils.js"));
 puts("Welcome to the Node.js REPL.");
 puts("Enter ECMAScript at the prompt.");
 puts("Tip 1: Use 'rlwrap node-repl' for a better interface");
index ea6500a..8654cc8 100644 (file)
@@ -73,9 +73,6 @@ more information.
 
 === The +process+ Object
 
-+process+ is the equivalent of +window+ in browser-side javascript. It is
-the global scope. +process+ is an instance of +process.EventEmitter+.
-
 [cols="1,2,10",options="header"]
 |=========================================================
 | Event    | Parameters | Notes
index 22045bb..52304d2 100644 (file)
@@ -1,4 +1,4 @@
-node.mixin(require("../common.js"));
+process.mixin(require("../common.js"));
 http = require("/http.js");
 PORT = 8888;
 
@@ -19,7 +19,7 @@ server.listen(PORT);
 var errors = 0;
 var successes = 0;
 
-var promise = node.cat("http://localhost:"+PORT, "utf8");
+var promise = process.cat("http://localhost:"+PORT, "utf8");
 
 promise.addCallback(function (content) {
   assertEquals(body, content);
@@ -31,11 +31,11 @@ promise.addErrback(function () {
   errors += 1;
 });
 
-var dirname = node.path.dirname(__filename);
-var fixtures = node.path.join(dirname, "fixtures");
-var x = node.path.join(fixtures, "x.txt");
+var dirname = process.path.dirname(__filename);
+var fixtures = process.path.join(dirname, "fixtures");
+var x = process.path.join(fixtures, "x.txt");
 
-promise = node.cat(x, "utf8");
+promise = process.cat(x, "utf8");
 
 promise.addCallback(function (content) {
   assertEquals("xyz", content.replace(/[\r\n]/, ''));
index 3746683..203d934 100644 (file)
@@ -1,10 +1,10 @@
-node.mixin(require('../common.js'));
+process.mixin(require('../common.js'));
 
 var PORT = 8003;
 var request_count = 1000;
 var response_body = '{"ok": true}';
 
-var server = node.http.createServer(function(req, res) {
+var server = process.http.createServer(function(req, res) {
  res.sendHeader(200, {'Content-Type': 'text/javascript'});
  res.sendBody(response_body);
  res.finish();
@@ -16,7 +16,7 @@ var requests_complete = 0;
 
 function onLoad () {
  for (var i = 0; i < request_count; i++) {
-   node.http.cat('http://localhost:'+PORT+'/', 'utf8')
+   process.http.cat('http://localhost:'+PORT+'/', 'utf8')
      .addCallback(function (content) {
        assertEquals(response_body, content)
        print(".");
@@ -30,12 +30,12 @@ function onLoad () {
      .addErrback(function() {
        print("-");
        requests_complete++;
-       //node.debug("error " + i);
+       //process.debug("error " + i);
      });
  }
 }
 
-function onExit () {
+process.addListener("exit", function () {
   assertEquals(request_count, requests_complete); 
   assertEquals(request_count, requests_ok); 
-}
+});
index 2789b2e..752ec8b 100644 (file)
@@ -1,4 +1,4 @@
-var s = node.http.createServer(function (req, res) {
+var s = process.http.createServer(function (req, res) {
   var body = "exports.A = function() { return 'A';}";
   res.sendHeader(200, [
     ["Content-Length", body.length],
@@ -9,7 +9,7 @@ var s = node.http.createServer(function (req, res) {
 });
 s.listen(8000);
 
-node.mixin(require("../common.js"));
+process.mixin(require("../common.js"));
 var a = require("http://localhost:8000/")
 
 assertInstanceof(a.A, Function);
index 352643a..cb78132 100644 (file)
@@ -1,8 +1,8 @@
-node.mixin(require("../common.js"));
+process.mixin(require("../common.js"));
 var dns = require("/dns.js");
 
-for (var i = 2; i < ARGV.length; i++) {
-  var name = ARGV[i]
+for (var i = 2; i < process.ARGV.length; i++) {
+  var name = process.ARGV[i]
   puts("looking up " + name);
   var resolution = dns.resolve4(name);