mirror of
https://github.com/leafo/moonscript.git
synced 2024-11-22 02:44:23 +00:00
don't swallow lua errors when in watch mode
This commit is contained in:
parent
79c33bb007
commit
bb9b48b3ea
12
bin/moonc
12
bin/moonc
@ -241,6 +241,9 @@ function get_sleep_func()
|
||||
end) then
|
||||
sleep = moonscript._sleep
|
||||
end
|
||||
if not sleep then
|
||||
error("Missing sleep function; install LuaSocket")
|
||||
end
|
||||
return sleep
|
||||
end
|
||||
|
||||
@ -254,12 +257,13 @@ end
|
||||
|
||||
-- returns an iterator that returns files that have been updated
|
||||
function create_watcher(files)
|
||||
local msg = "Starting watch loop, Ctrl-C to exit"
|
||||
local msg = "Starting watch loop (Ctrl-C to exit)"
|
||||
|
||||
local inotify
|
||||
pcall(function()
|
||||
inotify = require "inotify"
|
||||
end)
|
||||
inotify = nil
|
||||
|
||||
if inotify then
|
||||
local dirs = {}
|
||||
@ -324,7 +328,11 @@ if opts.w then
|
||||
-- catches interrupt error for ctl-c
|
||||
local protected = function()
|
||||
local status, file = pcall(watcher)
|
||||
if status then return file end
|
||||
if status then
|
||||
return file
|
||||
elseif file ~= "interrupted!" then
|
||||
error(file)
|
||||
end
|
||||
end
|
||||
|
||||
for fname in protected do
|
||||
|
Loading…
Reference in New Issue
Block a user