mirror of
https://github.com/samsonjs/repl-edit.git
synced 2026-04-27 15:07:40 +00:00
don't try to run a non-existent file
This commit is contained in:
parent
39a37af01f
commit
29ab97d58d
1 changed files with 9 additions and 0 deletions
|
|
@ -133,6 +133,15 @@ function pausingRepl(fn) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function runFile(filename, callback) {
|
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
|
var Script = process.binding('evals').Script
|
||||||
, evalcx = Script.runInContext
|
, evalcx = Script.runInContext
|
||||||
, read = fs.createReadStream(filename)
|
, read = fs.createReadStream(filename)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue