“The system cannot find the file specified” when starting process using ChildProcess
-
19-06-2021 - |
سؤال
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
لا تنتمي إلى StackOverflow