2012-07-08 149 views
1
起动过程中,当

当我运行下面的代码:“系统找不到指定的文件”使用子进程

require 'childprocess' 

process = ChildProcess.build("cucumber") 
process.start 

(这似乎是任何其他宝石可以代替黄瓜)

我得到错误:

C:/Ruby193/lib/ruby/gems/1.9.1/gems/childprocess-0.3.3/lib/childprocess/windows/process_builder.rb:87:in `create_process': The system cannot 
find the file specified. (2) (ChildProcess::LaunchError) 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/childprocess-0.3.3/lib/childprocess/windows/process_builder.rb:34:in `start' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/childprocess-0.3.3/lib/childprocess/windows/process.rb:63:in `launch_process' 
     from C:/Ruby193/lib/ruby/gems/1.9.1/gems/childprocess-0.3.3/lib/childprocess/abstract_process.rb:67:in `start' 
     from env.rb:4:in `<main>' 

当我在Windows cmd中使用例如cucumber,过程正常开始。

我该如何解决?为什么会发生?

回答

1

前几天有同样的麻烦。 您可以将ChildProcess指向cucumber.bat文件:

require 'childprocess' 

process = ChildProcess.build("C:\\Ruby193\\bin\\cucumber.bat") 
process.start 
相关问题