How to hide dos prompt?

C

camenix

Hi,
I want to run a ruby script on windows hiding dos prompt ,because
some code come from lib,
I can't use rubyw.exe to solve this problem.
The question is ,how to hiding dos prompt without deleting all the
"puts", "print","printf" in the code?
what should i do with $stderror and $stdout?
Any idea is welcome.
 
A

Austin Ziegler

I want to run a ruby script on windows hiding dos prompt ,because
some code come from lib,
I can't use rubyw.exe to solve this problem.
The question is ,how to hiding dos prompt without deleting all the
"puts", "print","printf" in the code?
what should i do with $stderror and $stdout?
Any idea is welcome.

You can only hide the DOS prompt by using rubyw.exe (there's no
console). You can, however redirect the STDERR and STDOUT (and STDIN,
don't forget) to either strings or files.

-austin
 
C

camenix

You can only hide the DOS prompt by using rubyw.exe (there's no
console). You can, however redirect the STDERR and STDOUT (and STDIN,
don't forget) to either strings or files.
How to redirect ? Is like this:
lib.rb
def hello
puts "hello,world!"
end

main.rb
require 'lib'
f=open('h.txt','w') # It didn't work
f.reopen($stdout) # It didn't work
puts "hi!"
hello
 

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

Forum statistics

Threads
473,770
Messages
2,569,588
Members
45,093
Latest member
Vinaykumarnevatia00

Latest Threads

Top