Errno::ENOEXEC

  • Thread starter Santhosh Kattissery
  • Start date
S

Santhosh Kattissery

I have the following line in my code:
puts `bundle install`

This gives me the following error:
C:/../<abc>.rb:11:in ``': Exec format error - bundle install
(Errno::ENOEXEC)

Im using a windows machine. What could be wrong?
Have anyone faced this issue?
 
A

Alex Stahl

Any reason you're using `backtics` around your string? If you're just
trying to print to console, use 'single' or "double" quotes. If you're
trying to execute an external command, then that command needs to be
installed.

Try it like this to just print to console:
puts 'bundle install' #using single quotes

When I use backtics on my linux machine, this lists the contents of the
current working directory:
puts `ls` #using backtics indicates system command

Hope this helps,
Alex
 
A

Alex S.

(Apologies if this is a dupe... I sent a reply email to the ML but
didn't see it go through).

Any reason you're using `backtics` around your string? If you're just
trying to print to console, use 'single' or "double" quotes. If you're
trying to execute an external command, then that command needs to be
installed.

Try it like this to just print to console:
puts 'bundle install' #using single quotes

When I use backtics on my linux machine, this lists the contents of the
current working directory:
puts `ls` #using backtics indicates system command to execute

Hope this helps,
Alex
 
S

Santhosh Kattissery

Thanks for you reply.
And yes, I am trying to execute a command.
puts `ls`, works for me.
install bundle works for me from command line.
But I want to execute it from ruby code.

I did not understand "then that command needs to be installed"
 
A

Alex Stahl

Do you have the path to the executable listed in your $PATH environment
variable?
 
G

Gourav Tiwari

Hi Alex

I am facing similar issue and I do have $PATH variable setup in the
windows.
Basically, it happens, when I run cucumber features on culerity gem.
Error is:

:):) failed steps :):)

Exec format error -
C:/Ruby/lib/ruby/gems/1.8/gems/culerity-0.2.10/lib/../bin/run_celerity_server.rb
(Errno::ENOEXEC)


The only line in run_celerity_server.rb I could see is:
#!/usr/bin/env jruby
require File.dirname(__FILE__) << '/../lib/culerity/celerity_server'
Culerity::CelerityServer.new(STDIN, STDOUT)

Thanks in advance.
-Gourav
 
G

Gordon Thiesfeld

Thanks for you reply.
And yes, I am trying to execute a command.
puts `ls`, works for me.
install bundle works for me from command line.
But I want to execute it from ruby code.

Which version of ruby are you using? You may need to run something like:

puts `bundle.bat install`

HTH

Gordon
 
G

Gourav Tiwari

Thanks for the reply Gordon

I will give it a try, by the way, I am using ruby 1.8.6 and jruby 1.5.1
 
G

Gordon Thiesfeld

Thanks for the reply Gordon

I will give it a try, by the way, I am using ruby 1.8.6 and jruby 1.5.1

Running ruby scripts are a bit different. You may want to try adding
'ruby ' to the begining

C:\Users\gthiesfeld\Work\repo>pik 1.8.6

C:\Users\gthiesfeld\Work\repo\pik>ruby -v
ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]

C:\Users\gthiesfeld\Work\repo>irb
irb(main):001:0> `test.rb`
Errno::ENOEXEC: Exec format error - test.rb
from (irb):1:in ``'
from (irb):1
irb(main):002:0> `ruby test.rb`
=> "Hello world!\n4\n"
irb(main):003:0> exit

C:\Users\gthiesfeld\Work\repo>pik jruby

C:\Users\gthiesfeld\Work\repo>ruby -v
'ruby' is not recognized as an internal or external command,
operable program or batch file.

C:\Users\gthiesfeld\Work\repo\pik>jruby -v
jruby 1.5.1 (ruby 1.8.7 patchlevel 249) (2010-06-06 f3a3480) (Java
HotSpot(TM) Client VM 1.6.0_20) [x86-java]

C:\Users\gthiesfeld\Work\repo>jirb
irb(main):001:0> `ruby test.rb`
=> "Hello world!\n4\n"
irb(main):002:0> exit
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,528
Members
45,000
Latest member
MurrayKeync

Latest Threads

Top