Running Curl inside Ruby using Command Expansion

Hello,

I am using the following command inside ruby

runCmd = %x{curl --proxy 192.168.0.5:3128 -d
userName=aaaa -d password=password -d command=put -o
./temp/putOutput.txt -d fileName=abc --config
./temp/tmpDataConfig.txt
https://192.168.0.8/RF/RemoteFileAccess}

This command fails within ruby but works on the
command line{in Linux}

Within Ruby Curl tries to open a Config file but
silently fails.

Is Ruby supposed to allow OS type commands like Curl
to open their own files?

I looked at ruby libCurl but it doesn’t run on
windows.

Thanking you in advance

Peter McGregor

What’s the failure? Does it get any better when you pass full
pathnames for the two files you have in the command line?

Why don’t you run strace and give us the output:

strace -o ruby.out -f -F -e trace=file,process ruby myRubyProgram.rb

Especially look for chdir() calls and failed opens of the config
file…

···

On Tuesday 02 July 2002 10:15 pm, comp Rules wrote:

I am using the following command inside ruby

runCmd = %x{curl --proxy 192.168.0.5:3128 -d
userName=aaaa -d password=password -d command=put -o
./temp/putOutput.txt -d fileName=abc --config
./temp/tmpDataConfig.txt
https://192.168.0.8/RF/RemoteFileAccess}

This command fails within ruby but works on the
command line{in Linux}

Within Ruby Curl tries to open a Config file but
silently fails.

Is Ruby supposed to allow OS type commands like Curl
to open their own files?


Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE

Sorry,

false alarm. I was writing a curl Config file within
Ruby and forgot to close it before I ran curl.

Thanks for the help. I also ran strace and it looks
like a cool tool

Regards
Peter McGregor

— Ned Konz ned@bike-nomad.com wrote: > On Tuesday
02 July 2002 10:15 pm, comp Rules wrote:

···

I am using the following command inside ruby

runCmd = %x{curl --proxy 192.168.0.5:3128 -d
userName=aaaa -d password=password -d command=put
-o
./temp/putOutput.txt -d fileName=abc --config
./temp/tmpDataConfig.txt
https://192.168.0.8/RF/RemoteFileAccess}

This command fails within ruby but works on the
command line{in Linux}

Within Ruby Curl tries to open a Config file but
silently fails.

Is Ruby supposed to allow OS type commands like
Curl
to open their own files?

What’s the failure? Does it get any better when you
pass full
pathnames for the two files you have in the command
line?

Why don’t you run strace and give us the output:

strace -o ruby.out -f -F -e trace=file,process ruby
myRubyProgram.rb

Especially look for chdir() calls and failed opens
of the config
file…


Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE

your using curl? how do you like it? what’s it like?

thanks if you’ve got a moment to anwser.

~transami

···

On Thu, 2002-07-04 at 20:04, comp Rules wrote:

Sorry,

false alarm. I was writing a curl Config file within
Ruby and forgot to close it before I ran curl.

Thanks for the help. I also ran strace and it looks
like a cool tool

Regards
Peter McGregor

— Ned Konz ned@bike-nomad.com wrote: > On Tuesday
02 July 2002 10:15 pm, comp Rules wrote:

I am using the following command inside ruby

runCmd = %x{curl --proxy 192.168.0.5:3128 -d
userName=aaaa -d password=password -d command=put
-o
./temp/putOutput.txt -d fileName=abc --config
./temp/tmpDataConfig.txt
https://192.168.0.8/RF/RemoteFileAccess}

This command fails within ruby but works on the
command line{in Linux}

Within Ruby Curl tries to open a Config file but
silently fails.

Is Ruby supposed to allow OS type commands like
Curl
to open their own files?

What’s the failure? Does it get any better when you
pass full
pathnames for the two files you have in the command
line?

Why don’t you run strace and give us the output:

strace -o ruby.out -f -F -e trace=file,process ruby
myRubyProgram.rb

Especially look for chdir() calls and failed opens
of the config
file…


Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE


~transami

“They that can give up essential liberty to obtain a little
temporary safety deserve neither liberty nor safety.”
– Benjamin Franklin

Its Ok,

I use Curl to send a file to a servlet.

Curl lets you send multiple POST parameters. It also lets you put these
command line parameters in a config file.
What I do then is read data from the file I want to send and then write
it to the end of the config file.

This works Ok for small files. However there some IO speed problems with
Ruby or Curl with big Files, say > 1Megabyte.
I UrlEncode and MD5sum the file data with Ruby. Curl also has to read
its large config file. It takes maybe a minute to do this for a large
file

Peter

···

On Friday, July 5, 2002, at 05:17 PM, Tom Sawyer wrote:

your using curl? how do you like it? what’s it like?

thanks if you’ve got a moment to anwser.

~transami

On Thu, 2002-07-04 at 20:04, comp Rules wrote:

Sorry,

false alarm. I was writing a curl Config file within
Ruby and forgot to close it before I ran curl.

Thanks for the help. I also ran strace and it looks
like a cool tool

Regards
Peter McGregor

— Ned Konz ned@bike-nomad.com wrote: > On Tuesday
02 July 2002 10:15 pm, comp Rules wrote:

I am using the following command inside ruby

runCmd = %x{curl --proxy 192.168.0.5:3128 -d
userName=aaaa -d password=password -d command=put
-o
./temp/putOutput.txt -d fileName=abc --config
./temp/tmpDataConfig.txt
https://192.168.0.8/RF/RemoteFileAccess}

This command fails within ruby but works on the
command line{in Linux}

Within Ruby Curl tries to open a Config file but
silently fails.

Is Ruby supposed to allow OS type commands like
Curl
to open their own files?

What’s the failure? Does it get any better when you
pass full
pathnames for the two files you have in the command
line?

Why don’t you run strace and give us the output:

strace -o ruby.out -f -F -e trace=file,process ruby
myRubyProgram.rb

Especially look for chdir() calls and failed opens
of the config
file…


Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE


~transami

“They that can give up essential liberty to obtain a little
temporary safety deserve neither liberty nor safety.”
– Benjamin Franklin