Apache2 and popen

I’m running Apache2 on windows and I have a controller that issues a
popen.

class FileController < ApplicationController
def index
f = IO.popen(“dir”)
@files = f.readlines
end
end

This works using webbrick but on Apache produces…


Errno::ENOENT in File#index

No such file or directory - dir

RAILS_ROOT: C:/www/teensymud/public/…/config/…
Application Trace | Framework Trace | Full Trace

#{RAILS_ROOT}/app/controllers/repository_controller.rb:3:in popen' #{RAILS_ROOT}/app/controllers/repository_controller.rb:3:inindex’


Is this a known Apache problem, misconfiguration problem, or Ruby or
Rails
issue?
I’m running 2.0.54.

Thanks,

Jon L.

OT: but for this directory listing i suggest you use Dir module

a=Dir[’*’]

[“rubygems-0.8.11.zip”, “ruby182-15.exe”, "ruby-oci8-0.1.13.tar.]

Mathieu C. wrote:

OT: but for this directory listing i suggest you use Dir module

a=Dir[’*’]

Yes, I’m actually running subversion commands from rscm. I just wanted
to
post the smallest and most easily produced code example that eliminated
other possible problems like ACL and PATH being wrong. That’s why I
used
dir.


J. Lambert

Yes, I’m actually running subversion commands from rscm. I just wanted to
post the smallest and most easily produced code example that eliminated
other possible problems like ACL and PATH being wrong. That’s why I used
dir.

Reproducted here (XP, Apache 2.0.55, FastCGI)

Perhaps passing “c:\win\cmd.exe /c dir” ?

Here i’m getting #IO:0x379a0d0

with @f = IO.popen(“c:/windows/system32/cmd.exe /c dir”)

and <%=debug @f %>

But I’saw a command windows appearing, not really clean…

Mathieu C. wrote:

Yes, I’m actually running subversion commands from rscm. I just
wanted to post the smallest and most easily produced code example
that eliminated other possible problems like ACL and PATH being
wrong. That’s why I used dir.

Reproducted here (XP, Apache 2.0.55, FastCGI)

Hmm. I am using FastCGI as well. So I switched to CGI and it works.
Looks like FastCGI and popen aren’t playing well together.


J Lambert