All,
When I can system("…") in ruby, I got either true or false returned,
but how do I capture the information that being printed out in console
when the cmd is being executed?
Thanks
All,
When I can system("…") in ruby, I got either true or false returned,
but how do I capture the information that being printed out in console
when the cmd is being executed?
Thanks
Yingqi T. wrote:
When I can system("…") in ruby, I got either true or false returned,
but how do I capture the information that being printed out in console
when the cmd is being executed?
By using backticks or %x{} instead of system.
use `` instead of system(“”)
On 6/4/07, Yingqi T. [email protected] wrote:
Posted via http://www.ruby-forum.com/.
–
“Hey brother christian with your high and mighty errand, Your actions
speak
so loud, I can’t hear a word you’re saying.”
-Greg Graffin (Bad Religion)
On Jun 4, 10:47 am, Sebastian H. [email protected]
wrote:
Yingqi T. wrote:
When I can system(“…”) in ruby, I got either true or false returned,
but how do I capture the information that being printed out in console
when the cmd is being executed?By using backticks or %x{} instead of system.
–
Ist so, weil ist so
Bleibt so, weil war so
Another option besides backticks or %x{} is to use IO#popen. This is
useful if you want to read output in the same manner as you would with
a file.
for example ls /etc
On 6/4/07, Glen H. [email protected] wrote:
speak so loud, I can’t hear a word you’re saying."
-Greg Graffin (Bad Religion)
–
“Hey brother christian with your high and mighty errand, Your actions
speak
so loud, I can’t hear a word you’re saying.”
-Greg Graffin (Bad Religion)
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs