# Capturing system console information

**URL:** <https://www.ruby-forum.com/t/capturing-system-console-information/157341>\
**Category:** Rails\
**Created:** [January 9, 2009, 5:12pm UTC](https://www.ruby-forum.com/t/capturing-system-console-information/157341 "2009-01-09T17:12:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rmac217](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@rmac217](https://www.ruby-forum.com/u/rmac217)\
**Post date:** [January 9, 2009, 5:12pm UTC](https://www.ruby-forum.com/t/capturing-system-console-information/157341/1 "2009-01-09T17:12:18Z")

</div>

Hello,

I have a simple web application that executes a .exe program through my  
controller. The exe program processes some information and displays an  
output on the script/server output. Is it possible to catch this  
information from the console and output it back to the user?

I have tried the following but it does not seem to work:

puts \<\< system.readlines(separator=$/)

Regards,  
McKenzie.

---

<div class="post-metadata">

**Author:** ![rmac217](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@rmac217](https://www.ruby-forum.com/u/rmac217)\
**Post date:** [January 9, 2009, 5:21pm UTC](https://www.ruby-forum.com/t/capturing-system-console-information/157341/2 "2009-01-09T17:21:05Z")

</div>

Ryan M. wrote:

> Regards,  
> McKenzie.

Perhaps the backtick method would work better? I found that system()  
calls sometimes returned random data at the end of the result.

output = `/path/to/app/to/execute`  
puts output

worked a lot better for my case.

HTH

Matt

---

<div class="post-metadata">

**Author:** ![rmac217](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/bc8723/32.png) [@rmac217](https://www.ruby-forum.com/u/rmac217)\
**Post date:** [January 9, 2009, 5:30pm UTC](https://www.ruby-forum.com/t/capturing-system-console-information/157341/3 "2009-01-09T17:30:23Z")

</div>

Matt H. wrote:

> Ryan M. wrote:
> 
> > Regards,  
> > McKenzie.
> 
> Perhaps the backtick method would work better? I found that system()  
> calls sometimes returned random data at the end of the result.
> 
> output = `/path/to/app/to/execute`  
> puts output
> 
> worked a lot better for my case.
> 
> HTH
> 
> Matt

Hi Matt,

I also need to input some parameters with the program to but I dont  
think the backtick method supports that? This is what I have so far…

if system("“E:\rails\public\progs\web.exe”  
“E:\rails\public\progs\temp.txt” set=“10"”)  
flash[:notice]= “Console output here”  
end

Thanks
