Re: Unix signals



The correct way to handle this would probably be via the glib unix utilities.
http://developer.gnome.org/glib/2.30/glib-UNIX-specific-utilities-and-integration.html

However, they are not currently exported to gir introspection. You might try asking on the glib mailing list for help adding them to the gir generation process.

Regards
Alan

 --- On 05/Sep/2012, Alberto José Rodríguez Rodríguez
	 wrote: 
> Hello,
> 
> I'm writting a gjs script that shows mplayer embedded in a GtkWindow. My
> problem is that if the main process receives a SIGSTOP or a SIGQUIT, it
> isn't propagated to the mplayer process. Is it possible to trap unix
> signals in gjs scripts? Or, is it possible to launch the mplayer process
> in the process group of the main process?
> 
> Thanks,
> 
> #! /usr/bin/gjs
> 
> const GLib = imports.gi.GLib;
> const Gtk = imports.gi.Gtk;
> const GdkX11 = imports.gi.GdkX11;
> const Lang = imports.lang;
> 
> if (ARGV.length != 1) {
>     printerr("No uri specified");
> } else {
>     Gtk.init(null);
> 
>     let window = new Gtk.Window  ({ decorated: false,
>             window_position: Gtk.WindowPosition.CENTER,
>             title: "TestMPlayer",
>             });
> 
>     window.fullscreen();
>     window.show_all();
>     
>     let [s, argv] = GLib.shell_parse_argv('mplayer -really-quiet -slave
> -noidle -noconsolecontrols -loop 0 -wid ' + window.window.get_xid() + '
> ' + ARGV[0]);
>     let [success, pid] = GLib.spawn_async(null, argv, null,
>                          GLib.SpawnFlags.SEARCH_PATH,
>                          null, null);
> 
>     window.connect('destroy', function() {
>         GLib.spawn_command_line_sync('kill ' + pid);
>         Gtk.main_quit();
>         }
>     );
> 
>     Gtk.main();
> }
> 
> 
> _______________________________________________
> javascript-list mailing list
> javascript-list gnome org
> https://mail.gnome.org/mailman/listinfo/javascript-list


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