don't try to run a non-existent file

This commit is contained in:
Sami Samhuri 2010-10-14 08:55:51 -07:00
parent 39a37af01f
commit 29ab97d58d

View file

@ -133,6 +133,15 @@ function pausingRepl(fn) {
}
function runFile(filename, callback) {
// check if file exists. might not have been saved.
try {
fs.statSync(filename)
} catch (e) {
_repl.stream.write('nothing to run\n')
callback()
return
}
var Script = process.binding('evals').Script
, evalcx = Script.runInContext
, read = fs.createReadStream(filename)