如何在heroku上执行二进制文件?
我尝试在 heroku 上执行二进制文件。我关注这个博客: http://www.verrot.fr/2010/02/24/executing-binary-files-with-ruby-on-rails-and-heroku/:
我有以下代码:
@exec = IO.popen("#{Rails.root}/bin/aapt version")
@result = @exec.gets
puts @result
当heroku在本地rails服务器上工作时,我在heroku上遇到以下错误:
command not found: app/bin/aapt version
您知道如何做到这一点吗?或者如果你已经这样做了?
I try to execute a binary on heroku. I follow this blog : http://www.verrot.fr/2010/02/24/executing-binary-files-with-ruby-on-rails-and-heroku/ :
I have the following code :
@exec = IO.popen("#{Rails.root}/bin/aapt version")
@result = @exec.gets
puts @result
I've got the following error on heroku while it's working on local rails server :
command not found: app/bin/aapt version
Have you got any idea on a way to do that ? Or if you already done that ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我是如何让它发挥作用的,但请注意,Heroku 不支持此解决方案。 Heroku 支持的直接引用是“你得靠自己”。
系统调用将返回 true 或 false。
How I have gotten this to work, but be warned, Heroku does not support this solution. The direct quote from Heroku Support is "you are on your own."
A true or false will be returned from the system call.
您是否确保本地二进制文件的权限允许执行? Git 具有权限意识。如果没有,您需要确保该文件允许可执行权限(如果必须,请修改权限),然后将修改后的文件添加到 git 并重新推送到 heroku,然后重试。请记住,用于执行文件的用户 heroku 可能是也可能不是所有者,因此您可能需要使用它们才能让 heroku 识别它。只是 chmod 777 bin/executable_name 作为最后的手段。
Did you make sure the permissions on your local binary allow execution? Git is permissions-aware. If not, you need to make sure the file allows executable permissions (modify the permissions if you must), then add the modified file to git and repush to heroku before trying again. Keep in mind that the user heroku will use to execute the file may or may not be the owner, so you may need to play with them in order to get heroku to recognize it. Just
chmod 777 bin/executable_name
as a last resort.