![]() | Chapter 12. Problem with ChildProcess gem under windows |
|
06 Aug 2012, 16:11
Victor Ch. (8 posts) |
Hello. <D:\Ruby192\lib\ruby\gems\1.9.1\gems\childprocess-0.3.4> Full error log here: <pre><d:\Work\tests\fruit>cucumber The system cannot find the file specified. (2) (ChildProcess::LaunchError) d:/Ruby192/lib/ruby/gems/1.9.1/gems/childprocess-0.3.4/lib/childprocess/windows/process_builder.rb:8 7:in `create_process' d:/Ruby192/lib/ruby/gems/1.9.1/gems/childprocess-0.3.4/lib/childprocess/windows/process_builder.rb:3 4:in `start' d:/Ruby192/lib/ruby/gems/1.9.1/gems/childprocess-0.3.4/lib/childprocess/windows/process.rb:63:in `la unch_process' d:/Ruby192/lib/ruby/gems/1.9.1/gems/childprocess-0.3.4/lib/childprocess/abstract_process.rb:67:in `s tart' d:/Work/tests/fruit/features/support/env.rb:6:in `<top (required)>' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/rb_support/rb_language.rb:129:in `lo ad' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/rb_support/rb_language.rb:129:in `lo ad_code_file' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/support_code.rb:171:in `load _file' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/support_code.rb:83:in `block in load_files!' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/support_code.rb:82:in `each' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime/support_code.rb:82:in `load_ files!' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime.rb:175:in `load_step_definit ions' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/runtime.rb:40:in `run!' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:43:in `execute!' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/lib/cucumber/cli/main.rb:20:in `execute' d:/Ruby192/lib/ruby/gems/1.9.1/gems/cucumber-1.2.1/bin/cucumber:14:in `<top (required)>' d:/Ruby192/bin/cucumber:19:in `load' d:/Ruby192/bin/cucumber:19:in `<main>'> |
|
06 Aug 2012, 16:30
Matt Wynne (83 posts) |
Hi, I don’t have the book to hand, but I presume that line 6 of env.rb where the error is coming from is where it tries to run rackup, is that correct? Can you try running the same command manually from a command prompt? |
|
07 Aug 2012, 06:30
Victor Ch. (8 posts) |
Hi. After some googling i find, that childprocess starts only Windows executables. And with this gem it fails. |
|
07 Aug 2012, 10:52
Matt Wynne (83 posts) |
This is odd, because it means that Childprocess can’t see the same set of commands that you can see from your cmd prompt. RubyGems should automatically create a .bat wrapper script for each of these commands, so somewhere on your machine there will be a rackup.bat which is what you were able to run manually. I wonder why Childprocess can’t see it. I guess this is something to do with paths. Is there anything unusual about your Ruby installation? Did you follow all the steps in the installation appendix chapter? |
|
07 Aug 2012, 13:10
Victor Ch. (8 posts) |
Yes, i have rackup.bat in my \bin dir of Ruby’s installation folder. And everythig is correct with PATH variable: i have this folder specified there. And i’ve followed all the steps of Cucumber installation (first of all). Mb, today, later, i try to launch this code at other PC, running same development enviroment. |
|
07 Aug 2012, 14:39
Matt Wynne (83 posts) |
Could you try changing the code to point to the full path to the rackup.bat file? I’m hoping some other Windows users will chime in here, it’s been a while for me I’m afraid :) |
|
07 Aug 2012, 21:37
Matt Wynne (83 posts) |
See https://twitter.com/luislavena/status/232890837… The maintainer of the Ruby one-click installer suggests you try “ruby -S rackup” instead of just “rackup” |
|
08 Aug 2012, 07:26
Victor Ch. (8 posts) |
Hello again. I’ve made a tiny .rb script, which launches only rackup, to easier testing: require 'childprocess'
process = ChildProcess.build("D:\Ruby192\bin\rackup.bat")
process.start
And with it I get a bit another error: d:/Ruby192/lib/ruby/gems/1.9.1/gems/childprocess-0.3.4/lib/childprocess/windows/process_builder.rb:87:in `create_process':
The system cannot find the file specified. (2) (ChildProcess::LaunchError)
from d:/Ruby192/lib/ruby/gems/1.9.1/gems/childprocess-0.3.4/lib/childprocess/windows/process_builder.rb:34:in `start'
from d:/Ruby192/lib/ruby/gems/1.9.1/gems/childprocess-0.3.4/lib/childprocess/windows/process.rb:63:in `launch_process'
from d:/Ruby192/lib/ruby/gems/1.9.1/gems/childprocess-0.3.4/lib/childprocess/abstract_process.rb:67:in `start'
from test.rb:4:in `<main>'
Seems like a bug in ruby. And sorry for my English. |
|
08 Aug 2012, 09:34
Jari Bakken (1 post) |
Can you try that again, but escape the slashes in the path?
|
|
08 Aug 2012, 10:30
Victor Ch. (8 posts) |
Escaping helps, ty, but i still got “config.ru not found” error. tried to add this file as a custom require. Ruby can not load this file too (mb I do something wrong?) |
|
08 Aug 2012, 12:02
Matt Wynne (83 posts) |
If you’ve got the error about config.ru not found, then you’re getting somewhere, because that means you’re now running rackup. Achievement unlocked! I guess you now need to pass a full path to the config.ru file as well, as it seems rackup isn’t able to figure out your current working directory. |
|
08 Aug 2012, 12:18
Victor Ch. (8 posts) |
Yes, that’s right. |
|
21 Aug 2012, 04:48
Sam Biggins (1 post) |
To close the loop on this, I had the same issue and was able to fix it by changing the “server =” line to:
server = ChildProcess.build("C:\\RailsInstaller\\Ruby1.9.3\\bin\\ruby", "-S", "rackup", "--port", "9999")
Also, great book! |
|
10 Jan 2013, 09:03
Rahul Panjiyar (6 posts) |
Also, This codes works fine. |
| You must be logged in to comment |

