06 Aug 2012, 16:11
9cae3e141882c928148b9a38d058f5f7_pragsmall

Victor Ch. (8 posts)

Hello. I Have an issue with code in chapter 12 (Testing any rest API) After i run the cucumber (pages 217-218) i have an error:

<D:\Ruby192\lib\ruby\gems\1.9.1\gems\childprocess-0.3.4>

Full error log here: 

<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 `'>
06 Aug 2012, 16:30
Avatar_pragsmall

Matt Wynne (87 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
9cae3e141882c928148b9a38d058f5f7_pragsmall

Victor Ch. (8 posts)

Hi. Thank you for your responce. Yes, this line is : “server.start” it’s really starts ‘rackup’. I can manually run ‘rackup’ from my cmd. I did this a few pages before.

After some googling i find, that childprocess starts only Windows executables. And with this gem it fails.

07 Aug 2012, 10:52
Avatar_pragsmall

Matt Wynne (87 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
9cae3e141882c928148b9a38d058f5f7_pragsmall

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. I’ll comment this topic after this.

07 Aug 2012, 14:39
Avatar_pragsmall

Matt Wynne (87 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
Avatar_pragsmall

Matt Wynne (87 posts)

See https://twitter.com/luislavena/status/232890837753790466

The maintainer of the Ruby one-click installer suggests you try “ruby -S rackup” instead of just “rackup”

08 Aug 2012, 07:26
9cae3e141882c928148b9a38d058f5f7_pragsmall

Victor Ch. (8 posts)

Hello again. I hope, i’ve found the source of the problem. First, i tried run “ruby -S rackup” in command line and got an error “configuration %WORKDOR%/config.ru not found” “Ok”< i thought, and start digging deeper. Next I try to use “ruby -S rackup” in my code. And get again “The system cannot find the file specified” Next step was try to point to “rackup.bat” And I did it with Windows-style path: “D:\Ruby192\bin\rackup.bat”. And got “cannot find the file specified” again. After that i tried to use nix style path “D:/Ruby192/bin/rackup.bat”. And *this time was an “configuration %WORKDOR%/config.ru not found” error. Yahoo! Seems like ruby interpreter can not correctly load “windows” paths.

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
Generic-user-small

Jari Bakken (1 post)

Can you try that again, but escape the slashes in the path?

@ChildProcess.build(“D:\Ruby192\bin\rackup.bat”)@

08 Aug 2012, 10:30
9cae3e141882c928148b9a38d058f5f7_pragsmall

Victor Ch. (8 posts)

Escaping helps, ty, but i still got “config.ru not found” error. This file is located in “Ruby192\lib\ruby\gems\1.9.1\gems\rack-1.4.1\test\rackup” folder.

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
Avatar_pragsmall

Matt Wynne (87 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
9cae3e141882c928148b9a38d058f5f7_pragsmall

Victor Ch. (8 posts)

Yes, that’s right. I can solve this (later), and now greate thanks to everybody, who tried to help. And abig thanks for you, Matt, for this great book and fast response.

21 Aug 2012, 04:48
207550_638069651533_6934787_n_pragsmall

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
20120621_115648_pragsmall

Rahul Panjiyar (6 posts)

server = ChildProcess.build("C:\\Ruby193\\bin\\rackup.bat", "--port", "9999")
server.start

Also, This codes works fine.

06 Mar 2014, 20:32
Generic-user-small

Ian Handley (1 post)

server = ChildProcess.build("C:\\Ruby193\\bin\\rackup.bat", "--port", "9999")
server.start

This

  You must be logged in to comment