Skip to content

Commit

Permalink
Refactored node spec runner
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Jan 5, 2010
1 parent 694572b commit 6f995d0
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions spec/node.js
Expand Up @@ -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
}

Expand Down

0 comments on commit 6f995d0

Please sign in to comment.