# Where has my output gone?

**URL:** <https://www.ruby-forum.com/t/where-has-my-output-gone/49861>\
**Category:** Ruby\
**Created:** [December 9, 2005, 2:13pm UTC](https://www.ruby-forum.com/t/where-has-my-output-gone/49861 "2005-12-09T14:13:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![andrew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@andrew](https://www.ruby-forum.com/u/andrew)\
**Post date:** [December 9, 2005, 2:13pm UTC](https://www.ruby-forum.com/t/where-has-my-output-gone/49861/1 "2005-12-09T14:13:47Z")

</div>

I run my ruby script, and it produces lots of output

I run the same script, but redirect the output to a file (bash shell  
using \>),  
no output!

Whats going on? I just know there is a simple answer, and I have a  
nagging  
feeling that its been discussed here before…

Help…quick…please… before I pull _all_ my hair out!

TIA

Andrew Walrond

---

<div class="post-metadata">

**Author:** ![andrew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@andrew](https://www.ruby-forum.com/u/andrew)\
**Post date:** [December 9, 2005, 2:54pm UTC](https://www.ruby-forum.com/t/where-has-my-output-gone/49861/2 "2005-12-09T14:54:48Z")

</div>

On Friday 09 December 2005 08:09 am, Andrew Walrond wrote:

> TIA
> 
> Andrew Walrond

Is there any chance that your program is outputting to stderr instead of  
stdout?

SteveT

Steve L.

> **[Troubleshooters.Com](http://www.troubleshooters.com)**
>
> The process and mindset of troubleshooting.

removed\_email\_address@domain.invalid

---

<div class="post-metadata">

**Author:** ![andrew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@andrew](https://www.ruby-forum.com/u/andrew)\
**Post date:** [December 9, 2005, 3:15pm UTC](https://www.ruby-forum.com/t/where-has-my-output-gone/49861/3 "2005-12-09T15:15:22Z")

</div>

On Friday 09 December 2005 13:52, Steve L. wrote:

> Is there any chance that your program is outputting to stderr instead of  
> stdout?

Nope; example:

root@orac main $ sbin/heretix --bs /home/andrew/prebuild/x86\_64/ --cf  
kdelibs version=none  
Build settings: cpu=x86\_64 build-jobs=4 make-jobs=4  
Processing…  
-u kdelibs  
-u kdebase  
root@orac main $ sbin/heretix --bs /home/andrew/prebuild/x86\_64/ --cf  
kdelibs version=none \> out  
root@orac main $ cat out  
root@orac main $

---

<div class="post-metadata">

**Author:** ![andrew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@andrew](https://www.ruby-forum.com/u/andrew)\
**Post date:** [December 9, 2005, 4:49pm UTC](https://www.ruby-forum.com/t/where-has-my-output-gone/49861/4 "2005-12-09T16:49:25Z")

</div>

On Friday 09 December 2005 15:02, Robert K. wrote:

> became a victim of buffering. Try $stdout.sync=true or $\>.sync=true at  
> the start of the script instead of pulling hair out.

Damn. I should have known that.

Thanks Robert!

Andrew Walrond

---

<div class="post-metadata">

**Author:** ![andrew](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/f19dbf/32.png) [@andrew](https://www.ruby-forum.com/u/andrew)\
**Post date:** [December 9, 2005, 4:04pm UTC](https://www.ruby-forum.com/t/where-has-my-output-gone/49861/5 "2005-12-09T16:04:23Z")

</div>

Andrew Walrond wrote:

> I run my ruby script, and it produces lots of output
> 
> I run the same script, but redirect the output to a file (bash shell  
> using \>), no output!
> 
> Whats going on? I just know there is a simple answer, and I have a  
> nagging feeling that its been discussed here before…
> 
> Help…quick…please… before I pull _all_ my hair out!

Did you wait until your script actually terminated? If not, you  
probably  
became a victim of buffering. Try $stdout.sync=true or $\>.sync=true at  
the start of the script instead of pulling hair out.

Kind regards

```
robert
```
