Permalink
Browse files

Detect when an invalid task name is used (by capturing STDERR) and ex…

…it with a friendly message
  • Loading branch information...
1 parent 7b48265 commit c0673f16d59d15c2dc3a4f2665da58156886d4c1 @chrisk committed Jan 12, 2009
Showing with 7 additions and 1 deletion.
  1. +7 −1 bin/livelydocs
View
8 bin/livelydocs
@@ -14,7 +14,13 @@ task_name = ARGV.shift
t = Thread.start do
loop do
- result = `rake -s #{task_name || "rdoc"}`
+ result = `rake -s #{task_name || "rdoc"} 2>&1`
+
+ if result =~ /Don't know how to build task '#{task_name}'/
+ puts "** The '#{task_name}' task couldn't be found. To use another task: #{$0} [task]"
+ break
+ end
+
puts result unless result.strip.empty?
sleep(1)
end

0 comments on commit c0673f1

Please sign in to comment.