Warn when output file not writeable

Mon, 27 Jul 2009 03:28:05 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Mon, 27 Jul 2009 03:28:05 +0100
changeset 32
d78440c40faa
parent 31
84b653f78e5f
child 33
575e8a530f30

Warn when output file not writeable

squish.lua file | annotate | diff | comparison | revisions
--- a/squish.lua	Mon Jul 27 03:27:32 2009 +0100
+++ b/squish.lua	Mon Jul 27 03:28:05 2009 +0100
@@ -145,7 +145,11 @@
 end
 
 print_info("Writing "..out_fn.."...");
-local f = io.open(out_fn, "w+");
+local f, err = io.open(out_fn, "w+");
+if not f then
+	print_err("Couldn't open output file: "..tostring(err));
+	os.exit(1);
+end
 
 if opts.executable then
 	if opts.executable == true then

mercurial