mirror of https://github.com/nodejs/node.git
A few more node->process changes
This commit is contained in:
parent
ad0a4cefb8
commit
57890465bd
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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]/, ''));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue