Permalink
Browse files

Added info about jake 'complete' event

  • Loading branch information...
mde
mde committed Aug 17, 2012
1 parent ec75832 commit e2098b63becdacc2b6da1eb68baa32289d5f0b8d
Showing with 17 additions and 1 deletion.
  1. +17 −1 README.md
View
@@ -93,7 +93,7 @@ Add the directory of node.exe to the environment PATH variable.
-t
--trace Enable full backtrace.
- -T
+ -T/ls
--tasks Display the tasks (matching optional PATTERN)
with descriptions, then exit.
@@ -293,6 +293,22 @@ command. You can do this by adding this line to your `.zshrc` file :
alias jake="noglob jake"
+### Cleanup after all tasks run, jake 'complete' event
+
+The base 'jake' object is an EventEmitter, and fires a 'complete' event after
+running all tasks.
+
+This is sometimes useful when a task starts a process which keeps the Node
+event-loop running (e.g., a database connection). If you know you want to stop
+the running Node process after all tasks have finished, you can set a listener
+for the 'complete' event, like so:
+
+```javascript
+jake.addListener('complete', function () {
+ process.exit();
+});
+```
+
### Running tasks from within other tasks
Jake supports the ability to run a task from within another task via the

0 comments on commit e2098b6

Please sign in to comment.