do not want to wait for text.bat

E

Eko Budi Setiyo

--------------030709070806030702000606
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

#
#inside openPdf.rb
#
openPdf = Thread.new{ check = exec("test.bat")
openPdf.stop }
puts 'done!'


#
#inside file "test.bat"
#
contents.pdf
exit

When I run "ruby openPdf.rb"
the "done!" message only apear after close contents.pdf file
Any body know how to make openPdf.rb does have to wait for "test.bat"
file to be closed before doing "puts 'done1' "?


Regards
Eko

--------------030709070806030702000606
Content-Type: message/rfc822;
name="do not want to wait for text.bat"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="do not want to wait for text.bat"

Message-ID: <[email protected]>
Date: Thu, 13 Jan 2005 15:48:40 +0800
From: Eko Budi Setiyo <[email protected]>
User-Agent: Mozilla Thunderbird 0.8 (Windows/20040913)
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: Ruby Mailing List <[email protected]>
Subject: do not want to wait for text.bat
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

#
#inside openPdf.rb
#
openPdf = Thread.new{
check = exec("test.bat")
openPdf.stop
}
puts 'done!'


#
#inside file "test.bat"
#
contents.pdf
exit

When I run "ruby openPdf.rb"
the "done!" message only apear after close contents.pdf file
Any body know how to make openPdf.rb does have to wait for "test.bat"
file to be closed before doing "puts 'done1' "?


Regards
Eko


--------------030709070806030702000606--
 
E

Eko Budi Setiyo

Daniel said:
Use IO.popen instead of exec.

Dan
Thanks a lot
It works
Is it working also for *nix box. If works then I can solved two problem
with one scripts
I don't have "linux box" now to test it

regards
Eko
 

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,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top