#! /usr/bin/ruby require 'thread' require 'gtk2' def create_main_window b = Gtk::Button.new("Click me") b.signal_connect('clicked') { pid = nil if pid = fork Thread.new { id, exitstatus = Process.waitpid2(pid) puts "finished with exitstatus #{exitstatus}" } else exec("sleep 3") end } $main_window = Gtk::Window.new $main_window.add(b) $main_window.window_position = Gtk::Window::POS_CENTER $main_window.show_all end puts "Using rg2 version #{Gtk::BINDING_VERSION.join('.')}" Thread.abort_on_exception = true Gtk.init create_main_window Gtk.main