From 6f995d0d4950a2c830b81217ff669057e971cb35 Mon Sep 17 00:00:00 2001 From: visionmedia Date: Tue, 5 Jan 2010 15:00:42 -0800 Subject: [PATCH] Refactored node spec runner --- spec/node.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/spec/node.js b/spec/node.js index 3263064369..6d0a3acef4 100644 --- a/spec/node.js +++ b/spec/node.js @@ -8,13 +8,12 @@ quit = process.exit print = puts readFile = function(path) { - var promise = require('posix').cat(path, 'utf8') - var result = '' - promise.addErrback(function(){ throw "failed to read file `" + path + "'" }) - promise.addCallback(function(contents){ - result = contents - }) - promise.wait() + var result + require('posix') + .cat(path, "utf8") + .addCallback(function(contents){ result = contents }) + .addErrback(function(){ throw new Error("failed to read file `" + path + "'") }) + .wait() return result }