I have two problems with my Ruby for Windows (1.8.4):
1. When I double-click on a file with .rb extention a DOS-like window
appears and dissapears immediately. I am not able to see results.
2. The Windows command (which should work as it's UNIX parent)
echo 'puts "Hello"' | ruby
(the command is borrowed from "Programming Ruby" 2nd edition p.318)
does not show any results:
···
=============
C:\Documents and Settings\Admin>echo 'puts "Hello"' | ruby
C:\Documents and Settings\Admin>
Sure, it works with Linux.
How to tune my Windows XT Pro to be more Ruby friendly?
Thank you
Henry
--
Posted via http://www.ruby-forum.com/.
C:\Documents and Settings\Admin>echo 'puts "Hello"' | ruby
C:\Documents and Settings\Admin>
Look at the output of the echo command:
C:\>echo 'puts "Hello"'
'puts "Hello"'
The windows shell includes the single-quote whaere as bash does not.
try:
C:\>echo puts "Hello" | ruby
Hello
C:\>
As for the problem with the DOS box. Adding a requireing input at the
end of the program is one (poor) solution, as is using a cmd shell. I
hope someone has a better one
J.F. Miller
···
--
Posted via http://www.ruby-forum.com/\.
I have two problems with my Ruby for Windows (1.8.4):
1. When I double-click on a file with .rb extention a DOS-like window
appears and dissapears immediately. I am not able to see results.
You need to open a command prompt and run it from there. Try
installing a shell extension with a "open command prompt here" option
if you need this a lot.
2. The Windows command (which should work as it's UNIX parent)
echo 'puts "Hello"' | ruby
echo 'puts "aa"'
'puts "aa"'
The cmd echo apparently includes the quotes, resulting in a string
which is valid ruby code but doesn't output anything.
Try:
echo puts "aa" | ruby
aa
ruby -e 'puts "aa"'
aa
···
On 9/8/06, Henry Savr <hsavr@yahoo.com> wrote:
Just write a little batch file:
@echo off
ruby %1
pause
Save it in your Ruby bin directory (I called mine rdos.bat), and
associate rb files with it. HTH.
Cheers,
Cory
···
On 9/8/06, Henry Savr <hsavr@yahoo.com> wrote:
I have two problems with my Ruby for Windows (1.8.4):
1. When I double-click on a file with .rb extention a DOS-like window
appears and dissapears immediately. I am not able to see results.
Start your program from the shell (cmd/DOS window). Then the window
will not go away, and you'll be able to see the result. I suppose you
did it that way in the next question, so I'm afraid I'm stating the
obvious 
If you want to see the results when doubleclicked the file, add
something that will pause your program at the end (e.g. gets, sleep)
or write your result to a file.
And in case you'd not want to see even the DOS window, rename your
file to .rbw 
···
On 9/8/06, Henry Savr <hsavr@yahoo.com> wrote:
I have two problems with my Ruby for Windows (1.8.4):
1. When I double-click on a file with .rb extention a DOS-like window
appears and dissapears immediately. I am not able to see results.
I have two problems with my Ruby for Windows (1.8.4):
1. When I double-click on a file with .rb extention a DOS-like window
appears and dissapears immediately. I am not able to see results.
In explorer, if you go to folder options, and click advanced for the
.rb extension, you will see that it uses the following to open a .rb
file:
"c:\ruby\bin\ruby.exe" "%1" %*
You can get the windows to stick around if you change that to:
cmd.exe /K "c:\ruby\bin\ruby.exe %1 %*"
I wouldn't recommend it tho, since you won't be able to accept files
with spaces and justhaving the windows stick around is nasty. Better
run your script from a cmd instance.
Thank you
Henry
HTH
···
On 9/8/06, Henry Savr <hsavr@yahoo.com> wrote:
--
Cristi BALAN
http://evil.che.lu/
http://evil.chelu.ro/