Skip to content
This repository has been archived by the owner on Oct 24, 2018. It is now read-only.

Commit

Permalink
fix #404
Browse files Browse the repository at this point in the history
  • Loading branch information
guinux committed Feb 3, 2018
1 parent f407b98 commit dde386c
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 250 deletions.
20 changes: 4 additions & 16 deletions src/system_daemon.vala
Expand Up @@ -271,27 +271,15 @@ namespace Pamac {
if (authorized) {
return true;
}
SourceFunc callback = check_authorization.callback;
try {
Polkit.Authority authority = Polkit.Authority.get_sync ();
Polkit.Subject subject = Polkit.SystemBusName.new (sender);
authority.check_authorization.begin (
Polkit.Subject subject = new Polkit.SystemBusName (sender);
var result = yield authority.check_authorization (
subject,
"org.manjaro.pamac.commit",
null,
Polkit.CheckAuthorizationFlags.ALLOW_USER_INTERACTION,
null,
(obj, res) => {
try {
var result = authority.check_authorization.end (res);
authorized = result.get_is_authorized ();
} catch (GLib.Error e) {
stderr.printf ("%s\n", e.message);
}
Idle.add ((owned) callback);
}
);
yield;
Polkit.CheckAuthorizationFlags.ALLOW_USER_INTERACTION);
authorized = result.get_is_authorized ();
} catch (GLib.Error e) {
stderr.printf ("%s\n", e.message);
}
Expand Down
23 changes: 9 additions & 14 deletions src/transaction.vala
Expand Up @@ -382,7 +382,6 @@ namespace Pamac {
}

async int spawn_in_term (string[] args, string? working_directory = null) {
SourceFunc callback = spawn_in_term.callback;
int status = 1;
term.set_pty (pty);
var launcher = new SubprocessLauncher (SubprocessFlags.NONE);
Expand All @@ -391,20 +390,16 @@ namespace Pamac {
launcher.set_child_setup (pty.child_setup);
try {
Subprocess process = launcher.spawnv (args);
process.wait_async.begin (build_cancellable, (obj, res) => {
try {
process.wait_async.end (res);
if (process.get_if_exited ()) {
status = process.get_exit_status ();
}
} catch (Error e) {
// cancelled
process.send_signal (Posix.SIGINT);
process.send_signal (Posix.SIGKILL);
try {
yield process.wait_async (build_cancellable);
if (process.get_if_exited ()) {
status = process.get_exit_status ();
}
Idle.add ((owned) callback);
});
yield;
} catch (Error e) {
// cancelled
process.send_signal (Posix.SIGINT);
process.send_signal (Posix.SIGKILL);
}
} catch (Error e) {
stderr.printf ("Error: %s\n", e.message);
}
Expand Down
220 changes: 0 additions & 220 deletions vapi/polkit-gobject-1.vapi

This file was deleted.

0 comments on commit dde386c

Please sign in to comment.