我正在尝试从.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无法找到库,因为它正在寻...
我正在尝试从.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 ruby??gems和Cygwin ruby???使用Cygwin ruby??gems似乎对我来说很好. (为什么你的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
本文标题为:c# – 从.NET执行Cygwin进程?
- Oracle中for循环的使用方法 2023-07-04
- 在C# 8中如何使用默认接口方法详解 2023-03-29
- WPF使用DrawingContext实现绘制刻度条 2023-07-04
- 如何使用C# 捕获进程输出 2023-03-10
- .NET CORE DI 依赖注入 2023-09-27
- Unity3D实现渐变颜色效果 2023-01-16
- C# 使用Aspose.Cells 导出Excel的步骤及问题记录 2023-05-16
- c# 模拟线性回归的示例 2023-03-14
- user32.dll 函数说明小结 2022-12-26
- Unity Shader实现模糊效果 2023-04-27