       else if opts.print  then puts js
       else if opts.lint   then lint js
       else                     write_js source, coffee.compile code
-    compile_scripts()
+  catch err
+    if opts.watch then puts err.message else throw err
+
+# Watch a list of source CoffeeScript files, recompiling them every time the
+# files are updated.
+watch_scripts: ->
+  for source in sources
+    process.watchFile source, {persistent: true, interval: 500}, (curr, prev) ->
+      return if curr.mtime.getTime() is prev.mtime.getTime()
+      fs.cat(source).addCallback (code) -> compile_script(source, code)
+
 
 # Write out a JavaScript source file with the compiled code.
 write_js: (source, js) ->

    flags: sources[(separator + 1)...sources.length]
    sources: sources[0...separator]
  process.ARGV = flags
  compile_scripts()
  this


# or JSLint results.
compile_scripts: ->
  return unless source: sources.shift()
  fs.cat(source).addCallback (code) ->
    compile_script(source, code)
    compile_scripts()

# Compile a single source script, containing the given code, according to the
# requested options. Both compile_scripts and watch_scripts share this method.
compile_script: (source, code) ->
  opts: options
  try
    if      opts.tokens   then coffee.print_tokens coffee.tokenize code
    else if opts.tree     then puts coffee.tree(code).toString()
    else
