Forum: Ruby on Rails Apache2 and popen

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
86b36e556cec3b988cae0bc907cbbfc6?d=identicon&s=25 Jon A. Lambert (Guest)
on 2006-01-05 17:44
(Received via mailing list)
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:in `index'

----------

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

Thanks,

Jon Lambert
F16def8015a7562a285c65a14be48540?d=identicon&s=25 Mathieu Chappuis (Guest)
on 2006-01-05 17:44
(Received via mailing list)
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.]
86b36e556cec3b988cae0bc907cbbfc6?d=identicon&s=25 Jon A. Lambert (Guest)
on 2006-01-05 17:47
(Received via mailing list)
Mathieu Chappuis 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
F16def8015a7562a285c65a14be48540?d=identicon&s=25 Mathieu Chappuis (Guest)
on 2006-01-05 19:57
(Received via mailing list)
> 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..
86b36e556cec3b988cae0bc907cbbfc6?d=identicon&s=25 Jon A. Lambert (Guest)
on 2006-01-07 13:37
(Received via mailing list)
Mathieu Chappuis 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
This topic is locked and can not be replied to.