简体   繁体   中英

rake task return on calling task

I would like to return from a rake task in the calling task. Does it possible?

Something like in this example, i would like to be able to call task one and one independantly but also one and two sequentially.

task: one
   do some work
   if work ok
      task.return true
   else
      puts "task one ko"
      task.return false
   end
end

task: two
   do some work
   if work ok
      task.return true
   else
      puts "task two ko"
      task.return false
   end
end

task: all
  Rake::Task["one"].invoke 
  Rake::Task["two"].invoke
end

I am not able to return in the "all" task. And "return" and abort("message") quit the script.

解决方案:任务是lambda块,这就是为什么我们必须使用“ next”而不是“ return”的原因。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM