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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/10.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 使用LaunchControl运行时,bash脚本中出现错误_Ruby_Macos_Bash_Applescript_Rvm - Fatal编程技术网

Ruby 使用LaunchControl运行时,bash脚本中出现错误

Ruby 使用LaunchControl运行时,bash脚本中出现错误,ruby,macos,bash,applescript,rvm,Ruby,Macos,Bash,Applescript,Rvm,我有以下脚本 #!/usr/bin/env ruby Dir.chdir('/Users/Chris/Sites/mentor') do audit = `/Users/Chris/.rvm/gems/ruby-2.1.6@mentor/bin/bundle-audit` system(%(osascript -e 'display notification "#{audit}" with title "bundle-audit"')) end 当我从本地文件夹运行它时,它会发出如下通

我有以下脚本

#!/usr/bin/env ruby
Dir.chdir('/Users/Chris/Sites/mentor') do
  audit = `/Users/Chris/.rvm/gems/ruby-2.1.6@mentor/bin/bundle-audit`
  system(%(osascript -e 'display notification "#{audit}" with title "bundle-audit"'))
end
当我从本地文件夹运行它时,它会发出如下通知

bundle-audit
No vulnerabilities found
但是,当LaunchControl定期运行同一个脚本时,只会发出通知

bundle-audit
stderr输出为

env: ruby_executable_hooks: No such file or directory

如何解决此问题?

解决此问题的一种方法是使用下面列出的教程。我总结了以下方法。摘要中包含了我遵循教程时出现的问题的修复

我的ruby任务名为
daily_checks.rb
,如下所示:

#!/usr/bin/env ruby
Dir.chdir('/Users/Chris/Documents/Sites/mentor') do
  audit = `bundle-audit`
  system(%(osascript -e 'display notification "#{audit}" with title "bundle-audit"'))
end
/usr/local/bin/regular\u checks.sh
中设置RVM别名和bash文件,其中包含以下内容:

#!/bin/bash
    /Users/Chris/.rvm/wrappers/regular_checks/ruby /Users/Chris/Documents/Sites/mentor/script/daily_checks.rb
注意:由于添加了
#,上述内容与本教程不同/bin/bash


完成此操作后,launchControl将成功运行bundle audit命令。

这是一个错误,而不是“输出丢失”。关于您的问题:您需要获取RVM init脚本的源代码。我已尝试将
source~/.RVM/scripts/RVM
放在脚本中,但不起作用。如何在Mac Osx 10.11.1上
source RVM init script
?请在问题中说明如何将
source~/.RVM/scripts/RVM
放入脚本中。这很重要。我现在遵循这里提倡的方法。但即使这样也不完全有效,所以我要问一个关于超级用户的更一般的问题,然后带着我希望的答案回到这里。