From 5809483b78902df5e8162ca74e923369b1cb3bf3 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 8 Mar 2010 13:35:08 -0800 Subject: [PATCH 01/10] Upgrade waf to 1.5.14a --- tools/wafadmin/Tools/config_c.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/wafadmin/Tools/config_c.py b/tools/wafadmin/Tools/config_c.py index 5663fb8b8e..6008265dda 100644 --- a/tools/wafadmin/Tools/config_c.py +++ b/tools/wafadmin/Tools/config_c.py @@ -541,8 +541,10 @@ def run_c_code(self, *k, **kw): # if we need to run the program, try to get its result if kw['execute']: + ak = {} # syntax for python < 2.5, don't touch + ak['stdout'] = ak['stderr'] = Utils.pproc.PIPE args = Utils.to_list(kw.get('exec_args', [])) - proc = Utils.pproc.Popen([lastprog], *args, stdout=Utils.pproc.PIPE, stderr=Utils.pproc.PIPE) + proc = Utils.pproc.Popen([lastprog], *args, **ak) (out, err) = proc.communicate() w = self.log.write w(str(out)) From 74614c1bf173ce2c655a5d3595b45e38fd5f12d1 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 8 Mar 2010 17:45:57 -0800 Subject: [PATCH 02/10] Change libev/wscript for waf 1.5.14 --- deps/libev/wscript | 1 - 1 file changed, 1 deletion(-) diff --git a/deps/libev/wscript b/deps/libev/wscript index 7075db7653..19e7bb2497 100644 --- a/deps/libev/wscript +++ b/deps/libev/wscript @@ -49,7 +49,6 @@ def configure(conf): int main() { struct timespec ts; int status = syscall(SYS_clock_gettime, CLOCK_REALTIME, &ts); - puts("1"); // fucking waf... return 0; } """ From 5861db8a69695e4f1a8c82ad2de55e4b07ab981a Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 8 Mar 2010 15:06:29 -0800 Subject: [PATCH 03/10] Remove process.mixin dependency from all tests. --- test/common.js | 8 ++++---- test/disabled/test-cat.js | 2 +- test/disabled/test-dns.js | 2 +- test/disabled/test-eio-race3.js | 2 +- test/disabled/test-fs-sendfile.js | 2 +- test/disabled/test-http-stress.js | 2 +- test/fixtures/echo.js | 2 +- test/fixtures/print-chars.js | 2 +- test/pummel/test-http-client-reconnect-bug.js | 2 +- test/pummel/test-keep-alive.js | 2 +- test/pummel/test-multipart.js | 2 +- test/pummel/test-process-spawn-loop.js | 2 +- test/pummel/test-tcp-many-clients.js | 2 +- test/pummel/test-tcp-pause.js | 2 +- test/pummel/test-tcp-pingpong-delay.js | 2 +- test/pummel/test-tcp-pingpong.js | 2 +- test/pummel/test-tcp-throttle.js | 2 +- test/pummel/test-tcp-timeout.js | 2 +- test/pummel/test-tcp-tls.js | 2 +- test/pummel/test-timers.js | 2 +- test/pummel/test-watch-file.js | 2 +- test/simple/test-assert.js | 2 +- test/simple/test-byte-length.js | 2 +- test/simple/test-chdir.js | 2 +- test/simple/test-child-process-env.js | 2 +- test/simple/test-delayed-require.js | 2 +- test/simple/test-eio-race.js | 2 +- test/simple/test-eio-race2.js | 2 +- test/simple/test-eio-race4.js | 2 +- test/simple/test-event-emitter-add-listeners.js | 2 +- test/simple/test-event-emitter-modify-in-emit.js | 2 +- test/simple/test-exception-handler.js | 2 +- test/simple/test-exec.js | 2 +- test/simple/test-file-read-noexist.js | 2 +- test/simple/test-file-read-stream.js | 2 +- test/simple/test-file-write-stream.js | 2 +- test/simple/test-fs-chmod.js | 2 +- test/simple/test-fs-realpath.js | 2 +- test/simple/test-fs-stat.js | 2 +- test/simple/test-fs-symlink.js | 2 +- test/simple/test-fs-write.js | 2 +- test/simple/test-http-1.0.js | 2 +- test/simple/test-http-cat.js | 2 +- test/simple/test-http-chunked.js | 2 +- test/simple/test-http-client-race.js | 2 +- test/simple/test-http-client-upload.js | 2 +- test/simple/test-http-eof-on-connect.js | 2 +- test/simple/test-http-malformed-request.js | 2 +- test/simple/test-http-proxy.js | 2 +- test/simple/test-http-server.js | 2 +- test/simple/test-http-tls.js | 2 +- test/simple/test-http-wget.js | 2 +- test/simple/test-http.js | 2 +- test/simple/test-idle-watcher.js | 2 +- test/simple/test-ini.js | 2 +- test/simple/test-memory-usage.js | 2 +- test/simple/test-mkdir-rmdir.js | 2 +- test/simple/test-module-loading.js | 2 +- test/simple/test-next-tick.js | 2 +- test/simple/test-path.js | 2 +- test/simple/test-process-buffering.js | 2 +- test/simple/test-process-kill.js | 2 +- test/simple/test-process-mixin.js | 4 ++-- test/simple/test-process-simple.js | 2 +- test/simple/test-querystring.js | 2 +- test/simple/test-readdir.js | 2 +- test/simple/test-remote-module-loading.js | 2 +- test/simple/test-signal-handler.js | 2 +- test/simple/test-stdio.js | 2 +- test/simple/test-stdout-flush.js | 2 +- test/simple/test-sync-fileread.js | 2 +- test/simple/test-sys.js | 3 +-- test/simple/test-tcp-binary.js | 2 +- test/simple/test-tcp-reconnect.js | 2 +- test/simple/test-umask.js | 2 +- test/simple/test-url.js | 2 +- test/simple/test-utf8-scripts.js | 2 +- 77 files changed, 81 insertions(+), 82 deletions(-) diff --git a/test/common.js b/test/common.js index 035fe7a00b..ec614564e2 100644 --- a/test/common.js +++ b/test/common.js @@ -1,5 +1,7 @@ var path = require("path"); +exports = module.exports = global; + exports.testDir = path.dirname(__filename); exports.fixturesDir = path.join(exports.testDir, "fixtures"); exports.libDir = path.join(exports.testDir, "../lib"); @@ -7,8 +9,6 @@ exports.PORT = 12346; require.paths.unshift(exports.libDir); -var assert = require('assert'); var sys = require("sys"); - -process.mixin(exports, sys); -exports.assert = require('assert'); \ No newline at end of file +for (var i in sys) exports[i] = sys[i]; +exports.assert = require('assert'); diff --git a/test/disabled/test-cat.js b/test/disabled/test-cat.js index f5110404dc..19edc29c6f 100644 --- a/test/disabled/test-cat.js +++ b/test/disabled/test-cat.js @@ -1,4 +1,4 @@ -process.mixin(require("../common.js")); +require("../common.js"); http = require("/http.js"); puts("hello world"); diff --git a/test/disabled/test-dns.js b/test/disabled/test-dns.js index 0d2bc2c395..675a2c330d 100644 --- a/test/disabled/test-dns.js +++ b/test/disabled/test-dns.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var dns = require("dns"), sys = require("sys"); diff --git a/test/disabled/test-eio-race3.js b/test/disabled/test-eio-race3.js index c911c077d9..8c70375a44 100644 --- a/test/disabled/test-eio-race3.js +++ b/test/disabled/test-eio-race3.js @@ -1,6 +1,6 @@ /* XXX Can this test be modified to not call the now-removed wait()? */ -process.mixin(require("../common")); +require("../common"); puts('first stat ...'); diff --git a/test/disabled/test-fs-sendfile.js b/test/disabled/test-fs-sendfile.js index 225657205b..eb8ac13b34 100644 --- a/test/disabled/test-fs-sendfile.js +++ b/test/disabled/test-fs-sendfile.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); sys = require("sys"); diff --git a/test/disabled/test-http-stress.js b/test/disabled/test-http-stress.js index da07bb72df..f6e6b795d0 100644 --- a/test/disabled/test-http-stress.js +++ b/test/disabled/test-http-stress.js @@ -1,4 +1,4 @@ -process.mixin(require('../common.js')); +require("../common"); var request_count = 1000; var response_body = '{"ok": true}'; diff --git a/test/fixtures/echo.js b/test/fixtures/echo.js index 0aed0ff84c..8cb96e2026 100644 --- a/test/fixtures/echo.js +++ b/test/fixtures/echo.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); process.stdio.open(); print("hello world\r\n"); diff --git a/test/fixtures/print-chars.js b/test/fixtures/print-chars.js index ba539ffb76..2f8b6cf769 100644 --- a/test/fixtures/print-chars.js +++ b/test/fixtures/print-chars.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var n = parseInt(process.argv[2]); diff --git a/test/pummel/test-http-client-reconnect-bug.js b/test/pummel/test-http-client-reconnect-bug.js index 67149e6a76..bdc709d356 100644 --- a/test/pummel/test-http-client-reconnect-bug.js +++ b/test/pummel/test-http-client-reconnect-bug.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var tcp = require("tcp"), sys = require("sys"), diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js index b77d815aeb..cf31c1eb63 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -1,5 +1,5 @@ // This test requires the program "ab" -process.mixin(require("../common")); +require("../common"); http = require("http"); sys = require("sys"); diff --git a/test/pummel/test-multipart.js b/test/pummel/test-multipart.js index c3fb9492ee..dd79af0290 100644 --- a/test/pummel/test-multipart.js +++ b/test/pummel/test-multipart.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var http = require("http"), multipart = require("multipart"), diff --git a/test/pummel/test-process-spawn-loop.js b/test/pummel/test-process-spawn-loop.js index 9a639ee9f1..6b8d9d8f4b 100644 --- a/test/pummel/test-process-spawn-loop.js +++ b/test/pummel/test-process-spawn-loop.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var N = 40; var finished = false; diff --git a/test/pummel/test-tcp-many-clients.js b/test/pummel/test-tcp-many-clients.js index 517b66ea4a..f6de67bc2d 100644 --- a/test/pummel/test-tcp-many-clients.js +++ b/test/pummel/test-tcp-many-clients.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); // settings var bytes = 1024*40; diff --git a/test/pummel/test-tcp-pause.js b/test/pummel/test-tcp-pause.js index 0316e7797d..71b83df9e2 100644 --- a/test/pummel/test-tcp-pause.js +++ b/test/pummel/test-tcp-pause.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); N = 200; diff --git a/test/pummel/test-tcp-pingpong-delay.js b/test/pummel/test-tcp-pingpong-delay.js index 5afe0eacdd..b0a2a18aaf 100644 --- a/test/pummel/test-tcp-pingpong-delay.js +++ b/test/pummel/test-tcp-pingpong-delay.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); diff --git a/test/pummel/test-tcp-pingpong.js b/test/pummel/test-tcp-pingpong.js index c90aa3b167..135b9a5958 100644 --- a/test/pummel/test-tcp-pingpong.js +++ b/test/pummel/test-tcp-pingpong.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); var tests_run = 0; diff --git a/test/pummel/test-tcp-throttle.js b/test/pummel/test-tcp-throttle.js index 32a7363722..2e6fdef3a1 100644 --- a/test/pummel/test-tcp-throttle.js +++ b/test/pummel/test-tcp-throttle.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); N = 60*1024; // 30kb diff --git a/test/pummel/test-tcp-timeout.js b/test/pummel/test-tcp-timeout.js index 6c04768dcf..b06c81da69 100644 --- a/test/pummel/test-tcp-timeout.js +++ b/test/pummel/test-tcp-timeout.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); exchanges = 0; starttime = null; diff --git a/test/pummel/test-tcp-tls.js b/test/pummel/test-tcp-tls.js index 9cdad204db..55612d6965 100644 --- a/test/pummel/test-tcp-tls.js +++ b/test/pummel/test-tcp-tls.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); fs=require("fs"); diff --git a/test/pummel/test-timers.js b/test/pummel/test-timers.js index 853df08ae3..ce371fa086 100644 --- a/test/pummel/test-timers.js +++ b/test/pummel/test-timers.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var WINDOW = 200; // why is does this need to be so big? diff --git a/test/pummel/test-watch-file.js b/test/pummel/test-watch-file.js index 3b9890037c..aaef2da7f4 100644 --- a/test/pummel/test-watch-file.js +++ b/test/pummel/test-watch-file.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var fs = require("fs"); var path = require("path"); diff --git a/test/simple/test-assert.js b/test/simple/test-assert.js index ea725f284c..610236856a 100644 --- a/test/simple/test-assert.js +++ b/test/simple/test-assert.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var a = require('assert'); diff --git a/test/simple/test-byte-length.js b/test/simple/test-byte-length.js index cd0f2c4814..465b6649c1 100644 --- a/test/simple/test-byte-length.js +++ b/test/simple/test-byte-length.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); assert.equal(14, process._byteLength("Il était tué")); assert.equal(14, process._byteLength("Il était tué", "utf8")); diff --git a/test/simple/test-chdir.js b/test/simple/test-chdir.js index 12ade044b6..bd9c522bfa 100644 --- a/test/simple/test-chdir.js +++ b/test/simple/test-chdir.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); assert.equal(true, process.cwd() !== __dirname); diff --git a/test/simple/test-child-process-env.js b/test/simple/test-child-process-env.js index 4b5d902030..4600fea9ef 100644 --- a/test/simple/test-child-process-env.js +++ b/test/simple/test-child-process-env.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); child = process.createChildProcess('/usr/bin/env', [], {'HELLO' : 'WORLD'}); response = ""; diff --git a/test/simple/test-delayed-require.js b/test/simple/test-delayed-require.js index ed9b9d8562..971cc271a1 100644 --- a/test/simple/test-delayed-require.js +++ b/test/simple/test-delayed-require.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); setTimeout(function () { a = require("../fixtures/a"); diff --git a/test/simple/test-eio-race.js b/test/simple/test-eio-race.js index bb9045ce13..580495923e 100644 --- a/test/simple/test-eio-race.js +++ b/test/simple/test-eio-race.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var count = 100; var fs = require('fs'); diff --git a/test/simple/test-eio-race2.js b/test/simple/test-eio-race2.js index c96aa8c473..374978904b 100644 --- a/test/simple/test-eio-race2.js +++ b/test/simple/test-eio-race2.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); var testTxt = path.join(fixturesDir, "x.txt"); var fs = require('fs'); diff --git a/test/simple/test-eio-race4.js b/test/simple/test-eio-race4.js index f5fb65a8ee..2109abaeee 100644 --- a/test/simple/test-eio-race4.js +++ b/test/simple/test-eio-race4.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var fs = require('fs'); var N = 100; var j = 0; diff --git a/test/simple/test-event-emitter-add-listeners.js b/test/simple/test-event-emitter-add-listeners.js index 2294372050..cdb9db7ef8 100644 --- a/test/simple/test-event-emitter-add-listeners.js +++ b/test/simple/test-event-emitter-add-listeners.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var events = require('events'); var e = new events.EventEmitter(); diff --git a/test/simple/test-event-emitter-modify-in-emit.js b/test/simple/test-event-emitter-modify-in-emit.js index cfd31ca519..25c2255873 100644 --- a/test/simple/test-event-emitter-modify-in-emit.js +++ b/test/simple/test-event-emitter-modify-in-emit.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var events = require('events'); var callbacks_called = [ ]; diff --git a/test/simple/test-exception-handler.js b/test/simple/test-exception-handler.js index fab4e44a44..61f92225e7 100644 --- a/test/simple/test-exception-handler.js +++ b/test/simple/test-exception-handler.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var MESSAGE = 'catch me if you can'; var caughtException = false; diff --git a/test/simple/test-exec.js b/test/simple/test-exec.js index 7f9dd8db17..d899073324 100644 --- a/test/simple/test-exec.js +++ b/test/simple/test-exec.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); success_count = 0; error_count = 0; diff --git a/test/simple/test-file-read-noexist.js b/test/simple/test-file-read-noexist.js index ae162f2a97..13cd7f9c77 100644 --- a/test/simple/test-file-read-noexist.js +++ b/test/simple/test-file-read-noexist.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); var fs = require('fs'); var got_error = false; diff --git a/test/simple/test-file-read-stream.js b/test/simple/test-file-read-stream.js index ab41487090..df57387947 100644 --- a/test/simple/test-file-read-stream.js +++ b/test/simple/test-file-read-stream.js @@ -1,4 +1,4 @@ -process.mixin(require('../common')); +require('../common'); var path = require('path'), diff --git a/test/simple/test-file-write-stream.js b/test/simple/test-file-write-stream.js index 60f693a222..579455c7d9 100644 --- a/test/simple/test-file-write-stream.js +++ b/test/simple/test-file-write-stream.js @@ -1,4 +1,4 @@ -process.mixin(require('../common')); +require('../common'); var path = require('path'), diff --git a/test/simple/test-fs-chmod.js b/test/simple/test-fs-chmod.js index 7b6cd52b92..f8c4d71453 100644 --- a/test/simple/test-fs-chmod.js +++ b/test/simple/test-fs-chmod.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); var fs = require('fs'); var got_error = false; diff --git a/test/simple/test-fs-realpath.js b/test/simple/test-fs-realpath.js index 7efb0b4509..2bf444e5f8 100644 --- a/test/simple/test-fs-realpath.js +++ b/test/simple/test-fs-realpath.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var fs = require('fs'); var path = require('path'); var async_completed = 0, async_expected = 0, unlink = []; diff --git a/test/simple/test-fs-stat.js b/test/simple/test-fs-stat.js index 3f85032cef..5f5333d1b8 100644 --- a/test/simple/test-fs-stat.js +++ b/test/simple/test-fs-stat.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var fs = require('fs'); var got_error = false; var success_count = 0; diff --git a/test/simple/test-fs-symlink.js b/test/simple/test-fs-symlink.js index 79eedb90e4..3217ff437f 100644 --- a/test/simple/test-fs-symlink.js +++ b/test/simple/test-fs-symlink.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); var fs = require('fs'); var completed = 0; diff --git a/test/simple/test-fs-write.js b/test/simple/test-fs-write.js index 4670570ab3..8290d9a086 100644 --- a/test/simple/test-fs-write.js +++ b/test/simple/test-fs-write.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); var fs = require('fs'); var fn = path.join(fixturesDir, "write.txt"); diff --git a/test/simple/test-http-1.0.js b/test/simple/test-http-1.0.js index 8a54b90342..ceca527719 100644 --- a/test/simple/test-http-1.0.js +++ b/test/simple/test-http-1.0.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); http = require("http"); diff --git a/test/simple/test-http-cat.js b/test/simple/test-http-cat.js index 7e729b275e..e81a5c502f 100644 --- a/test/simple/test-http-cat.js +++ b/test/simple/test-http-cat.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); http = require("http"); var body = "exports.A = function() { return 'A';}"; diff --git a/test/simple/test-http-chunked.js b/test/simple/test-http-chunked.js index 4bcabcc942..28d4cc6424 100644 --- a/test/simple/test-http-chunked.js +++ b/test/simple/test-http-chunked.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var http = require("http"); var UTF8_STRING = "Il était tué"; diff --git a/test/simple/test-http-client-race.js b/test/simple/test-http-client-race.js index acea6993f3..9076924b37 100644 --- a/test/simple/test-http-client-race.js +++ b/test/simple/test-http-client-race.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); http = require("http"); url = require("url"); diff --git a/test/simple/test-http-client-upload.js b/test/simple/test-http-client-upload.js index 8c05de4d37..4c11bd4078 100644 --- a/test/simple/test-http-client-upload.js +++ b/test/simple/test-http-client-upload.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); http = require("http"); var sent_body = ""; diff --git a/test/simple/test-http-eof-on-connect.js b/test/simple/test-http-eof-on-connect.js index ffa07b1ebb..67d4b28fe9 100644 --- a/test/simple/test-http-eof-on-connect.js +++ b/test/simple/test-http-eof-on-connect.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); http = require("http"); diff --git a/test/simple/test-http-malformed-request.js b/test/simple/test-http-malformed-request.js index 5121df4d4a..a1d4b8c91a 100644 --- a/test/simple/test-http-malformed-request.js +++ b/test/simple/test-http-malformed-request.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); http = require("http"); url = require("url"); diff --git a/test/simple/test-http-proxy.js b/test/simple/test-http-proxy.js index 6f3af1d449..20992b9dc6 100644 --- a/test/simple/test-http-proxy.js +++ b/test/simple/test-http-proxy.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); http = require("http"); url = require("url"); diff --git a/test/simple/test-http-server.js b/test/simple/test-http-server.js index fc5e6f1552..fba33ba9fc 100644 --- a/test/simple/test-http-server.js +++ b/test/simple/test-http-server.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); http = require("http"); url = require("url"); diff --git a/test/simple/test-http-tls.js b/test/simple/test-http-tls.js index ed4277ca2e..0784829421 100644 --- a/test/simple/test-http-tls.js +++ b/test/simple/test-http-tls.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var http = require("http"); var url = require("url"); var fs = require('fs'); diff --git a/test/simple/test-http-wget.js b/test/simple/test-http-wget.js index dfe9701e61..09bda32593 100644 --- a/test/simple/test-http-wget.js +++ b/test/simple/test-http-wget.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); http = require("http"); diff --git a/test/simple/test-http.js b/test/simple/test-http.js index cd91d49904..c59927763a 100644 --- a/test/simple/test-http.js +++ b/test/simple/test-http.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); http = require("http"); url = require("url"); diff --git a/test/simple/test-idle-watcher.js b/test/simple/test-idle-watcher.js index 8bfca5dfaa..5debfa4f7e 100644 --- a/test/simple/test-idle-watcher.js +++ b/test/simple/test-idle-watcher.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var complete = false; var idle = new process.IdleWatcher(); diff --git a/test/simple/test-ini.js b/test/simple/test-ini.js index c9d0f8897f..72ccbfcf3b 100644 --- a/test/simple/test-ini.js +++ b/test/simple/test-ini.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); var fs = require("fs"); parse = require("ini").parse; diff --git a/test/simple/test-memory-usage.js b/test/simple/test-memory-usage.js index 8a2a29fc64..8efe0f5913 100644 --- a/test/simple/test-memory-usage.js +++ b/test/simple/test-memory-usage.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var r = process.memoryUsage(); puts(inspect(r)); diff --git a/test/simple/test-mkdir-rmdir.js b/test/simple/test-mkdir-rmdir.js index 24e8835991..1464370ce6 100644 --- a/test/simple/test-mkdir-rmdir.js +++ b/test/simple/test-mkdir-rmdir.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); var fs = require('fs'); diff --git a/test/simple/test-module-loading.js b/test/simple/test-module-loading.js index 1d796d0324..0d99c25a90 100644 --- a/test/simple/test-module-loading.js +++ b/test/simple/test-module-loading.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); debug("load test-module-loading.js"); diff --git a/test/simple/test-next-tick.js b/test/simple/test-next-tick.js index 9758535320..810ed70826 100644 --- a/test/simple/test-next-tick.js +++ b/test/simple/test-next-tick.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var complete = 0; diff --git a/test/simple/test-path.js b/test/simple/test-path.js index 961d6d1fa2..4e5a703ea3 100644 --- a/test/simple/test-path.js +++ b/test/simple/test-path.js @@ -1,5 +1,5 @@ var path = require("path"); -process.mixin(require("../common")); +require("../common"); var f = __filename; diff --git a/test/simple/test-process-buffering.js b/test/simple/test-process-buffering.js index 50d6ae622c..7837740300 100644 --- a/test/simple/test-process-buffering.js +++ b/test/simple/test-process-buffering.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var pwd_called = false; diff --git a/test/simple/test-process-kill.js b/test/simple/test-process-kill.js index 9d2bf091f1..6ee9e5fa3f 100644 --- a/test/simple/test-process-kill.js +++ b/test/simple/test-process-kill.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var exit_status = -1; diff --git a/test/simple/test-process-mixin.js b/test/simple/test-process-mixin.js index ca7bf9545b..0fbe09a70c 100644 --- a/test/simple/test-process-mixin.js +++ b/test/simple/test-process-mixin.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var target = function() {}; process.mixin(target, { @@ -43,4 +43,4 @@ process.mixin(true, target, { }); assert.notStrictEqual(['bar'], target.foo); -assert.deepEqual(['bar'], target.foo); \ No newline at end of file +assert.deepEqual(['bar'], target.foo); diff --git a/test/simple/test-process-simple.js b/test/simple/test-process-simple.js index ab6f87a21a..dad8f44442 100644 --- a/test/simple/test-process-simple.js +++ b/test/simple/test-process-simple.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var cat = process.createChildProcess("cat"); diff --git a/test/simple/test-querystring.js b/test/simple/test-querystring.js index 9295ff7e12..3e018a62d0 100644 --- a/test/simple/test-querystring.js +++ b/test/simple/test-querystring.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); // test using assert diff --git a/test/simple/test-readdir.js b/test/simple/test-readdir.js index 67d1151c11..c90fe37359 100644 --- a/test/simple/test-readdir.js +++ b/test/simple/test-readdir.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); var fs = require('fs'); diff --git a/test/simple/test-remote-module-loading.js b/test/simple/test-remote-module-loading.js index f2463a4ebd..0a2af87e08 100644 --- a/test/simple/test-remote-module-loading.js +++ b/test/simple/test-remote-module-loading.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var http = require('http'); var sys = require('sys'); diff --git a/test/simple/test-signal-handler.js b/test/simple/test-signal-handler.js index a2d76e651a..5e772d192a 100644 --- a/test/simple/test-signal-handler.js +++ b/test/simple/test-signal-handler.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); puts("process.pid: " + process.pid); diff --git a/test/simple/test-stdio.js b/test/simple/test-stdio.js index c88774a9a2..3c33fcfe66 100644 --- a/test/simple/test-stdio.js +++ b/test/simple/test-stdio.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); var sub = path.join(fixturesDir, 'echo.js'); diff --git a/test/simple/test-stdout-flush.js b/test/simple/test-stdout-flush.js index fe0273fc62..06864a6b87 100644 --- a/test/simple/test-stdout-flush.js +++ b/test/simple/test-stdout-flush.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var path = require('path'); var sub = path.join(fixturesDir, 'print-chars.js'); diff --git a/test/simple/test-sync-fileread.js b/test/simple/test-sync-fileread.js index 318d0621bd..297652c0ab 100644 --- a/test/simple/test-sync-fileread.js +++ b/test/simple/test-sync-fileread.js @@ -1,4 +1,4 @@ -process.mixin(require('../common')); +require('../common'); var path = require('path'); var fs = require('fs'); diff --git a/test/simple/test-sys.js b/test/simple/test-sys.js index d2b50a3a1a..5d2ccdf9e4 100644 --- a/test/simple/test-sys.js +++ b/test/simple/test-sys.js @@ -1,5 +1,4 @@ -process.mixin(require("../common")); -process.mixin(require("sys")); +require("../common"); assert.equal("0", inspect(0)); assert.equal("1", inspect(1)); diff --git a/test/simple/test-tcp-binary.js b/test/simple/test-tcp-binary.js index 796061b0a0..e1d85542c3 100644 --- a/test/simple/test-tcp-binary.js +++ b/test/simple/test-tcp-binary.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); binaryString = ""; diff --git a/test/simple/test-tcp-reconnect.js b/test/simple/test-tcp-reconnect.js index 090ec61be1..2a1ce652a5 100644 --- a/test/simple/test-tcp-reconnect.js +++ b/test/simple/test-tcp-reconnect.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); tcp = require("tcp"); var N = 50; diff --git a/test/simple/test-umask.js b/test/simple/test-umask.js index 8674642bae..3de9565faa 100644 --- a/test/simple/test-umask.js +++ b/test/simple/test-umask.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var mask = 0664; var old = process.umask(mask); diff --git a/test/simple/test-url.js b/test/simple/test-url.js index b474812d87..0b81191fce 100644 --- a/test/simple/test-url.js +++ b/test/simple/test-url.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); var url = require("url"), sys = require("sys"); diff --git a/test/simple/test-utf8-scripts.js b/test/simple/test-utf8-scripts.js index 8346d43fac..a3b46e1dcc 100644 --- a/test/simple/test-utf8-scripts.js +++ b/test/simple/test-utf8-scripts.js @@ -1,4 +1,4 @@ -process.mixin(require("../common")); +require("../common"); // üäö From a38aa02f9f31ab7ace90c737e064bb6f2b78e3cd Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 8 Mar 2010 15:06:46 -0800 Subject: [PATCH 04/10] Remove process.mixin dependency from fs --- lib/fs.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index 9461f2d820..22d4afb443 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -444,7 +444,8 @@ var FileReadStream = exports.FileReadStream = function(path, options) { this.mode = 0666; this.bufferSize = 4 * 1024; - process.mixin(this, options || {}); + options = options || {}; + for (var i in options) this[i] = options[i]; var self = this, @@ -555,7 +556,8 @@ var FileWriteStream = exports.FileWriteStream = function(path, options) { this.encoding = 'binary'; this.mode = 0666; - process.mixin(this, options || {}); + options = options || {}; + for (var i in options) this[i] = options[i]; var self = this, From c488e5775a57391b9b2a8037f849975c0084d05c Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 8 Mar 2010 15:07:06 -0800 Subject: [PATCH 05/10] Remove process.mixin dependencies from benchmark scripts --- benchmark/http_simple.js | 3 ++- benchmark/process_loop.js | 3 ++- benchmark/run.js | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js index 8bfc097244..b83c2c9430 100644 --- a/benchmark/http_simple.js +++ b/benchmark/http_simple.js @@ -3,7 +3,8 @@ path = require("path"); libDir = path.join(path.dirname(__filename), "../lib"); require.paths.unshift(libDir); -process.mixin(require("sys")); +var sys = (require("sys")); +for (var i in sys) global[i] = sys[i]; http = require("http"); fixed = "" diff --git a/benchmark/process_loop.js b/benchmark/process_loop.js index 372a89cf34..0ee61b76a2 100644 --- a/benchmark/process_loop.js +++ b/benchmark/process_loop.js @@ -1,7 +1,8 @@ var path = require("path"); libDir = path.join(path.dirname(__filename), "../lib"); require.paths.unshift(libDir); -process.mixin(require("sys")); +var sys = (require("sys")); +for (var i in sys) global[i] = sys[i]; function next (i) { if (i <= 0) return; diff --git a/benchmark/run.js b/benchmark/run.js index 8466b9760f..60b7752c7a 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -1,7 +1,8 @@ var path = require("path"); libDir = path.join(path.dirname(__filename), "../lib"); require.paths.unshift(libDir); -process.mixin(require("sys")); +var sys = (require("sys")); +for (var i in sys) global[i] = sys[i]; var benchmarks = [ "static_http_server.js" , "timers.js" , "process_loop.js" From 04999ef969d62aa96291db34dcaf275efe6c0a63 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 8 Mar 2010 18:04:54 -0800 Subject: [PATCH 06/10] Remove -Werror from deps/v8/SConstruct -_- --- benchmark/http_simple.js | 3 +-- deps/v8/SConstruct | 1 - 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js index b83c2c9430..9025e5d940 100644 --- a/benchmark/http_simple.js +++ b/benchmark/http_simple.js @@ -3,8 +3,7 @@ path = require("path"); libDir = path.join(path.dirname(__filename), "../lib"); require.paths.unshift(libDir); -var sys = (require("sys")); -for (var i in sys) global[i] = sys[i]; +var puts = require("sys").puts; http = require("http"); fixed = "" diff --git a/deps/v8/SConstruct b/deps/v8/SConstruct index 0b038039ef..5483663fd6 100644 --- a/deps/v8/SConstruct +++ b/deps/v8/SConstruct @@ -267,7 +267,6 @@ V8_EXTRA_FLAGS = { 'gcc': { 'all': { 'WARNINGFLAGS': ['-Wall', - '-Werror', '-W', '-Wno-unused-parameter', '-Wnon-virtual-dtor'] From fb6dc11f112b7b6ec989d5fa882d094327e8fdf3 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Mon, 8 Mar 2010 19:06:25 -0800 Subject: [PATCH 07/10] Clean up some things in the benchmarks --- benchmark/process_loop.js | 9 +++------ benchmark/run.js | 15 ++++++--------- benchmark/static_http_server.js | 6 ++---- 3 files changed, 11 insertions(+), 19 deletions(-) diff --git a/benchmark/process_loop.js b/benchmark/process_loop.js index 0ee61b76a2..55ad6c4495 100644 --- a/benchmark/process_loop.js +++ b/benchmark/process_loop.js @@ -1,15 +1,12 @@ -var path = require("path"); -libDir = path.join(path.dirname(__filename), "../lib"); -require.paths.unshift(libDir); -var sys = (require("sys")); -for (var i in sys) global[i] = sys[i]; +var sys = require("../lib/sys"); + function next (i) { if (i <= 0) return; var child = process.createChildProcess("echo", ["hello"]); child.addListener("output", function (chunk) { - if (chunk) print(chunk); + if (chunk) sys.print(chunk); }); child.addListener("exit", function (code) { diff --git a/benchmark/run.js b/benchmark/run.js index 60b7752c7a..b1ab79ecc1 100644 --- a/benchmark/run.js +++ b/benchmark/run.js @@ -1,18 +1,15 @@ var path = require("path"); -libDir = path.join(path.dirname(__filename), "../lib"); -require.paths.unshift(libDir); -var sys = (require("sys")); -for (var i in sys) global[i] = sys[i]; +var sys = require("../lib/sys"); var benchmarks = [ "static_http_server.js" , "timers.js" , "process_loop.js" ]; -var benchmark_dir = path.dirname(__filename); +var benchmarkDir = path.dirname(__filename); function exec (script, callback) { var start = new Date(); - var child = process.createChildProcess(process.ARGV[0], [path.join(benchmark_dir, script)]); + var child = process.createChildProcess(process.ARGV[0], [path.join(benchmarkDir, script)]); child.addListener("exit", function (code) { var elapsed = new Date() - start; callback(elapsed, code); @@ -21,12 +18,12 @@ function exec (script, callback) { function runNext (i) { if (i >= benchmarks.length) return; - print(benchmarks[i] + ": "); + sys.print(benchmarks[i] + ": "); exec(benchmarks[i], function (elapsed, code) { if (code != 0) { - puts("ERROR "); + sys.puts("ERROR "); } - puts(elapsed); + sys.puts(elapsed); runNext(i+1); }); }; diff --git a/benchmark/static_http_server.js b/benchmark/static_http_server.js index 5b4f220ba8..398b9bf204 100644 --- a/benchmark/static_http_server.js +++ b/benchmark/static_http_server.js @@ -1,7 +1,5 @@ -var path = require("path"); -libDir = path.join(path.dirname(__filename), "../lib"); -require.paths.unshift(libDir); -http = require("http"); +var http = require("../lib/http"); + var concurrency = 30; var port = 8000; var n = 700; From 602d1861a1cb5ff426aa17c3d1c2ddb8423b7ac1 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 8 Mar 2010 15:07:26 -0800 Subject: [PATCH 08/10] Remove process.mixin from repl --- bin/node-repl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/node-repl b/bin/node-repl index 82eb1bca12..9dfdd0ab5a 100755 --- a/bin/node-repl +++ b/bin/node-repl @@ -1,6 +1,7 @@ #!/usr/bin/env node -process.mixin(require('sys')); +puts = require("sys").puts; + puts("Welcome to the Node.js REPL."); puts("Enter ECMAScript at the prompt."); puts("Tip 1: Use 'rlwrap node-repl' for a better interface"); From b90d63b9983186a2f13a2ef7d399960f979fc486 Mon Sep 17 00:00:00 2001 From: isaacs Date: Mon, 8 Mar 2010 15:08:30 -0800 Subject: [PATCH 09/10] Change the include() message so that it doesn't recommend process.mixin. --- src/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/node.js b/src/node.js index afc70bf88f..4fcd67d5ad 100644 --- a/src/node.js +++ b/src/node.js @@ -13,7 +13,7 @@ function removed (reason) { } GLOBAL.__module = removed("'__module' has been renamed to 'module'"); -GLOBAL.include = removed("include(module) has been removed. Use process.mixin(GLOBAL, require(module)) to get the same effect."); +GLOBAL.include = removed("include(module) has been removed. Use require(module)"); GLOBAL.puts = removed("puts() has moved. Use require('sys') to bring it back."); GLOBAL.print = removed("print() has moved. Use require('sys') to bring it back."); GLOBAL.p = removed("p() has moved. Use require('sys') to bring it back."); From f8eb16372835f1f17deeb2b169c6d5a14a50cd40 Mon Sep 17 00:00:00 2001 From: Aaron Heckmann Date: Mon, 8 Mar 2010 20:42:10 -0500 Subject: [PATCH 10/10] Add removeAllListeners --- doc/api.txt | 3 +++ src/node.js | 6 ++++++ test/simple/test-event-emitter-modify-in-emit.js | 6 ++++++ 3 files changed, 15 insertions(+) diff --git a/doc/api.txt b/doc/api.txt index a6ca6bf11a..c745bc8716 100644 --- a/doc/api.txt +++ b/doc/api.txt @@ -263,6 +263,9 @@ server.addListener("connection", function (socket) { Remove a listener from the listener array for the specified event. *Caution*: changes array indices in the listener array behind the listener. ++emitter.removeAllListeners(event)+ :: +Removes all listeners from the listener array for the specified event. + +emitter.listeners(event)+ :: Returns an array of listeners for the specified event. This array can be manipulated, e.g. to remove listeners. diff --git a/src/node.js b/src/node.js index 4fcd67d5ad..0398ba261f 100644 --- a/src/node.js +++ b/src/node.js @@ -186,6 +186,12 @@ var eventsModule = createInternalModule('events', function (exports) { return this; }; + process.EventEmitter.prototype.removeAllListeners = function (type) { + // does not use listeners(), so no side effect of creating _events[type] + if (!type || !this._events || !this._events.hasOwnProperty(type)) return this; + this._events[type].length = 0; + }; + process.EventEmitter.prototype.listeners = function (type) { if (!this._events) this._events = {}; if (!this._events.hasOwnProperty(type)) this._events[type] = []; diff --git a/test/simple/test-event-emitter-modify-in-emit.js b/test/simple/test-event-emitter-modify-in-emit.js index 25c2255873..1dd94ba712 100644 --- a/test/simple/test-event-emitter-modify-in-emit.js +++ b/test/simple/test-event-emitter-modify-in-emit.js @@ -30,3 +30,9 @@ assert.deepEqual(["callback1", "callback2"], callbacks_called); e.emit("foo"); assert.equal(0, e.listeners("foo").length); assert.deepEqual(["callback1", "callback2"], callbacks_called); + +e.addListener("foo", callback1); +e.addListener("foo", callback2); +assert.equal(2, e.listeners("foo").length) +e.removeAllListeners("foo") +assert.equal(0, e.listeners("foo").length) \ No newline at end of file