Execute bash commands from a Rakefile

后端 未结 5 2063
余生分开走
余生分开走 2020-11-30 01:57

I would like to execute a number of bash commands from a Rakefile.

I have tried the following in my Rakefile

         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-11-30 02:40

    I think the way rake wants this to happen is with: http://rubydoc.info/gems/rake/FileUtils#sh-instance_method Example:

    task :test do
      sh "ls"
    end
    

    The built-in rake function sh takes care of the return value of the command (the task fails if the command has a return value other than 0) and in addition it also outputs the commands output.

提交回复
热议问题