I have some difficulties with my perl + gtk GUI app. Why can't perl catch bzip2's output text from console? Instead of being catched into variable, output is just printed in console. I have no problem with any other program - it's just bzip2.
My code:
wypisz($cmd);
my $out = `$cmd`;
wypisz($out);
wypisz("end");
Result: $cmd
and "end" printed properly - nothing more. Bzip2's output is just printedwypisz()
is my function used to put the text into gtkTextView
:
sub wypisz {
my $text = shift;
my $textbuffer = $::Glade->get_widget( 'v_console' )->get_buffer;
my $textiter = $textbuffer->get_end_iter;
$textbuffer->insert($textiter,"$text\n");
$::Glade->get_widget( 'v_console' )->set_buffer($textbuffer)
}
Try
my $out = `$cmd 2>&1`;
to redirect stderr to stdout