From bb9b48b3ea0c6de4db6c53abc17186389d17339f Mon Sep 17 00:00:00 2001 From: leaf corcoran Date: Wed, 30 Nov 2011 19:25:41 -0800 Subject: [PATCH] don't swallow lua errors when in watch mode --- bin/moonc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bin/moonc b/bin/moonc index 6da89ef..3472925 100755 --- a/bin/moonc +++ b/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