cygwin 上的 Ruby - 权限被拒绝
我正在尝试从 ruby 脚本运行 gcc,它给了我一个错误,提示权限被拒绝。 当直接从命令行运行它时它工作得很好,这让我不明白为什么它不能从 ruby 运行。 我可以从 Ruby 中调用其他命令,例如“ls”。
我还尝试将 gcc 的文件权限设置为 777 并使我的用户帐户成为该文件的所有者。
这是我的 shell 输出:
Administrator@dominicgraec8aa ~
$ gcc
gcc: no input files
Administrator@dominicgraec8aa ~
$ irb
irb(main):001:0> `gcc`
Errno::EACCES: Permission denied - gcc
from (irb):1:in ``'
from (irb):1
irb(main):002:0> `ls`
=> ""
我希望任何人对此有一个想法。
I am trying to run gcc from a ruby script and it gives me an error which says Permission denied.
It works fine when running it right from the commandline and that makes me clueless why it won't work from ruby.
I can call other commands like "ls" from within Ruby.
I also tried setting the file permissions of gcc to 777 as well as making my user-account the owner of that file.
Here is my shell output:
Administrator@dominicgraec8aa ~
$ gcc
gcc: no input files
Administrator@dominicgraec8aa ~
$ irb
irb(main):001:0> `gcc`
Errno::EACCES: Permission denied - gcc
from (irb):1:in ``'
from (irb):1
irb(main):002:0> `ls`
=> ""
I hope anyone has an idea on this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
根据我的经验,在 Windows 上的 Ruby 中使用什么路径分隔符并不重要,因为它们都应该可以工作(并且它们也可以在命令行上工作)。当使用两种不同的环境(本机 Windows 和 Cygwin)时,最好确保您知道正在运行哪个版本,因为它们不一定彼此兼容。
我在运行 Ruby 工具链的本机 Windows 版本时没有遇到任何问题,甚至使用 Pik(例如 Windows 的 RVM)也是如此,而且我发现它比管理两个环境简单得多。
From my experience it doesn't matter what path separator you use in Ruby on Windows as they both should work (and as they both work on the command line as well). When working with two different environments (Native Windows and Cygwin) it is good to make sure that you know which version you are running, since they are not necessarily compatible with each other.
I've had no problems running the native Windows versions of the Ruby toolchain, even using Pik too (like RVM for Windows), and I find it much simpler than having to manage two environments.