open/fork from a callback hang the windows (gtk2::helper)



Hello gtk-perl team !

I try to make a program that launch a command when a button is pressed
and monitor his output with some progress bars. I have found that
there are a Gtk2::helper->add_watch method for doing this.

But if I fork the command with "open" in a callback, the gtkmain
thread hangs until the command finish. I'm sure that the open call is
non-blocking.

sub my_callback {

   my $fd = FileHandle->new()
   open($fd, "mycommand | ") or quitCallback("can't fork")

}
--> hang on return

I don't really understand why. Maybe Gtk make the callbacks with new
threads and wait the result with waitpid ?

On all gtk2::helper examples I've found, the "open" call is made
before Gtk2->main. How can I do if the windows is already displayed
and if I'm inside gtkmain ?

Thanks !

Baptiste.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]