jashkenas/coffee-script — pull request #3234 by marchaefner (2013-11-10 07:47:21+00:00)
Title: Fixes #3087 -- Use `fs.*Sync` for CLI compilation

Fixes #3087 by using synchronous `fs` functions, as @jashenkas [suggested](https://github.com/jashkenas/coffee-script/pull/3087#issuecomment-26680461).

(Also removed a never used variable.)

#### Why this is safe

`compilePath` is called by:

* `run` -- the "main" function, only invoked by `bin/coffee` (and by no means an API). This is exactly the place where we need less asynchronicity.

* `compilePath` itself (See also below)

* the `setTimeout` callback in `watchDir`. This just runs once it's started and nothing depends on its timing.

`compilePath` itself is now synchronous / blocking (it does not call any asynchronous functions). This means that watchers will now predictably run only after `compilePath` has finished (and not possibly in the midst of it).

Performance impact (if any) should be negligible since compilation is largely CPU bound.