“The system cannot find the file specified” when starting process using ChildProcess

StackOverflow https://stackoverflow.com/questions/11386339

سؤال

When I run the following code:

require 'childprocess'

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

(It seem that any other gem can be instead cucumber)

I get error:

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>'

When I run it in Windows cmd using e.g. cucumber, process starts normally.

How can I solve it? Why it occurs?

هل كانت مفيدة؟

المحلول

Have same trouble a few days ago. You can point ChildProcess to cucumber.bat file:

require 'childprocess'

process = ChildProcess.build("C:\\Ruby193\\bin\\cucumber.bat")
process.start
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top