From 57890465bdea58f7cc576d917e30bca7a6683c5d Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 29 Oct 2009 23:59:35 +0100 Subject: [PATCH] A few more node->process changes --- bin/node-repl | 2 +- doc/api.txt | 3 --- test/mjsunit/disabled/test-cat.js | 12 ++++++------ test/mjsunit/disabled/test-http-stress.js | 12 ++++++------ test/mjsunit/disabled/test-remote-module-loading.js | 4 ++-- test/mjsunit/disabled/test_dns.js | 6 +++--- 6 files changed, 18 insertions(+), 21 deletions(-) diff --git a/bin/node-repl b/bin/node-repl index 00975dc..e08dee0 100755 --- a/bin/node-repl +++ b/bin/node-repl @@ -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"); diff --git a/doc/api.txt b/doc/api.txt index ea6500a..8654cc8 100644 --- a/doc/api.txt +++ b/doc/api.txt @@ -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 diff --git a/test/mjsunit/disabled/test-cat.js b/test/mjsunit/disabled/test-cat.js index 22045bb..52304d2 100644 --- a/test/mjsunit/disabled/test-cat.js +++ b/test/mjsunit/disabled/test-cat.js @@ -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]/, '')); diff --git a/test/mjsunit/disabled/test-http-stress.js b/test/mjsunit/disabled/test-http-stress.js index 3746683..203d934 100644 --- a/test/mjsunit/disabled/test-http-stress.js +++ b/test/mjsunit/disabled/test-http-stress.js @@ -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); -} +}); diff --git a/test/mjsunit/disabled/test-remote-module-loading.js b/test/mjsunit/disabled/test-remote-module-loading.js index 2789b2e..752ec8b 100644 --- a/test/mjsunit/disabled/test-remote-module-loading.js +++ b/test/mjsunit/disabled/test-remote-module-loading.js @@ -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); diff --git a/test/mjsunit/disabled/test_dns.js b/test/mjsunit/disabled/test_dns.js index 352643a..cb78132 100644 --- a/test/mjsunit/disabled/test_dns.js +++ b/test/mjsunit/disabled/test_dns.js @@ -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); -- 2.7.4