# Rubyw and stdout

**URL:** <https://www.ruby-forum.com/t/rubyw-and-stdout/62829>\
**Category:** Ruby\
**Created:** [June 8, 2006, 4:34pm UTC](https://www.ruby-forum.com/t/rubyw-and-stdout/62829 "2006-06-08T16:34:14Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![markcasio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@markcasio](https://www.ruby-forum.com/u/markcasio)\
**Post date:** [June 8, 2006, 4:34pm UTC](https://www.ruby-forum.com/t/rubyw-and-stdout/62829/1 "2006-06-08T16:34:14Z")

</div>

If you run a script with rubyw under Windows and the script writes to  
stdout, is there a way to capture that output without modifying the  
script? Is there a rubyw option for specifying where the output should  
go?

---

<div class="post-metadata">

**Author:** ![markcasio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@markcasio](https://www.ruby-forum.com/u/markcasio)\
**Post date:** [June 8, 2006, 4:37pm UTC](https://www.ruby-forum.com/t/rubyw-and-stdout/62829/2 "2006-06-08T16:37:25Z")

</div>

rubyscript2exe suggests this:

----- Original Message ----  
From: Mark V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: ruby-talk ML [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Thursday, June 8, 2006 9:31:26 AM  
Subject: rubyw and stdout

If you run a script with rubyw under Windows and the script writes to  
stdout, is there a way to capture that output without modifying the  
script? Is there a rubyw option for specifying where the output should  
go?

---

<div class="post-metadata">

**Author:** ![markcasio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@markcasio](https://www.ruby-forum.com/u/markcasio)\
**Post date:** [June 8, 2006, 4:50pm UTC](https://www.ruby-forum.com/t/rubyw-and-stdout/62829/3 "2006-06-08T16:50:35Z")

</div>

I just noticed that you want to do this without modifying the script.  
This would be a better way to do it then.

c:\rubyscripts\>rubyw test.rbw \> test.log  
c:\rubyscripts\>

---

<div class="post-metadata">

**Author:** ![markcasio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/e9bcb4/32.png) [@markcasio](https://www.ruby-forum.com/u/markcasio)\
**Post date:** [June 8, 2006, 4:40pm UTC](https://www.ruby-forum.com/t/rubyw-and-stdout/62829/4 "2006-06-08T16:40:57Z")

</div>

sorry, hit send by accident.

Anyway, rubyscript2exe suggests doing this:

$stdout = $stderr = File.new(“/path/to/temp/application.log”, “w”)

----- Original Message ----  
From: Mark V. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: ruby-talk ML [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Thursday, June 8, 2006 9:31:26 AM  
Subject: rubyw and stdout

If you run a script with rubyw under Windows and the script writes to  
stdout, is there a way to capture that output without modifying the  
script? Is there a rubyw option for specifying where the output should  
go?
