我正在尝试从.NET应用程序启动Cygwin版本的ruby.exe,但我被卡住了.
c:\>"c:\cygwin\bin\ruby.exe" c:\test\ruby.rb
/usr/bin/ruby: no such file to load -- ubygems (LoadError)
如你所见,Ruby无法找到库,因为它正在寻找一些Linux风格的路径.
显然,当我从.NET运行ruby.exe时,由于无法找到库,它就像上面那样失败了.
如果我没有加载任何库它工作正常:
c:\>"c:\cygwin\bin\ruby.exe" -v
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-cygwin]
最初cygwin从这个cygwin.bat开始
chdir C:\cygwin\bin
bash --login -i
我怎样才能让.NET首先进入cygwin环境,然后在那个环境中执行ruby?
>我不能使用Windows Ruby,我需要cygwin ruby.
>我知道交互式驱动“bash”的潜在用法但听起来很脏,除非有很好的方法.
解决方法:
您是否正在使用混合本机Windows rubygems和Cygwin ruby?使用Cygwin rubygems似乎对我来说很好. (为什么你的Cygwin ruby解释器显然在搜索带有Windows反斜杠的路径?).
或者,你试过run.exe吗?
C:\cygwin\bin\run.exe -p /starting/dir exe_to_run
这是man-page条目:
NAME
run – start programs with hidden console window
SYNOPSIS
run [ -p path ] command [ -wait ] arguments
runcommand [ -p path ] [ -wait ] arguments
DESCRIPTION
Windows programs are either GUI programs or console programs. When
started console programs will either attach to an existing console
or create a new one. GUI programs can never attach to an exiting con-
sole. There is no way to attach to an existing console but hide it if
started as GUI program.run will do this for you. It works as intermediate and starts a pro-
gram but makes the console window hidden.With -p path you can add path to the PATH environment variable.
Issuing -wait as first program argument will make run wait for program
completition, otherwise it returns immediately.The second variant is for creating wrappers. If the executable is
named runcommand (eg runemacs), run will try to start the program (eg
emacs).EXAMPLES
run -p /usr/X11R6/bin xterm
run emacs -wait
runemacs -waitrun make -wait
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。