Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/ruby/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 如果系统调用返回错误,则使rake任务失败_Ruby_Rake_Rake Task - Fatal编程技术网

Ruby 如果系统调用返回错误,则使rake任务失败

Ruby 如果系统调用返回错误,则使rake任务失败,ruby,rake,rake-task,Ruby,Rake,Rake Task,我有一个Rakefile,我用它来自动化我项目中的一些任务 在某些任务中,我调用系统,但是,即使进程返回错误, 任务继续进行,没有任何问题 我怎样才能避免呢?我想在某个子进程返回错误时使rake退出 提前感谢您可以评估 是调用命令的Rake方式。它将以简洁的消息失败。与system相比,sh也会打印出命令 哦,就这么简单。谢谢 system('inexistent command') or exit!(1) puts "This line is not reached"

我有一个Rakefile,我用它来自动化我项目中的一些任务

在某些任务中,我调用
系统
,但是,即使进程返回错误, 任务继续进行,没有任何问题

我怎样才能避免呢?我想在某个子进程返回错误时使rake退出


提前感谢

您可以评估


是调用命令的Rake方式。它将以简洁的消息失败。与
system
相比,
sh
也会打印出命令

哦,就这么简单。谢谢
system('inexistent command') or exit!(1)
puts "This line is not reached"