Skip to content

Instantly share code, notes, and snippets.

@arteymix
Created July 28, 2016 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arteymix/b1d9e5c9462d898b7d334285f2e46450 to your computer and use it in GitHub Desktop.
Save arteymix/b1d9e5c9462d898b7d334285f2e46450 to your computer and use it in GitHub Desktop.
public class Updater.Application : GLib.Application
{
public override int command_line (ApplicationCommandLine command_line) {
var dnf = new Subprocess (SubprocessFlags.NONE, "dnf", "install", "glib-2.0-devel");
hold (); // hold until the operation completes
dnf.wait_check_async (() => {
try {
dnf.wait_check_async.end ();
} finally {
release ();
}
});
return 0;
}
}
@gavr123456789
Copy link

Update

void main () {
    var proc = new Subprocess (SubprocessFlags.NONE, "sh", "-c", "sleep 2; true");

    proc.wait_check_async.begin (null, (obj, res) => {
        try {
            proc.wait_check_async.end (res);
            print ("sucessful\n");
        } catch (Error e) {
            print ("error: %s\n", e.message);
        }
    });

    var loop = new MainLoop ();
    loop.run ();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment