Commit e7b59749 authored by Niels De Graef's avatar Niels De Graef

ssh: operation: Use Posix.Signal.TERM conditionally

Starting from vala 0.40, `Posix.SIGTERM` was deprecated in favor of
`Posix.Signal.TERM`. This was handled by
!39, which
unfortunately broke the code for older versions of Valac. Let's do a
compromise and change the behaviour in and preprocessor macro `#if` that
checks the valac version.
parent 4a01a3cd
Pipeline #77419 passed with stage
in 6 minutes and 45 seconds
......@@ -80,8 +80,15 @@ public abstract class Operation : GLib.Object {
on_spawn_setup_child, out this.pid, out fin, out fout, out ferr);
ulong cancelled_sig = 0;
if (cancellable != null)
cancelled_sig = cancellable.connect(() => { Posix.kill(this.pid, Posix.Signal.TERM); });
if (cancellable != null) {
cancelled_sig = cancellable.connect(() => {
#if VALA_0_40
Posix.kill(this.pid, Posix.Signal.TERM);
#else
Posix.kill(this.pid, Posix.SIGTERM);
#endif
});
}
// Copy the input for later writing
if (input != null) {
......@@ -141,7 +148,11 @@ public abstract class Operation : GLib.Object {
}
} catch (GLib.Error e) {
critical("Couldn't read output of SSH command. Error: %s", e.message);
#if VALA_0_40
Posix.kill(this.pid, Posix.Signal.TERM);
#else
Posix.kill(this.pid, Posix.SIGTERM);
#endif
return false;
}
......@@ -159,7 +170,11 @@ public abstract class Operation : GLib.Object {
}
} catch (GLib.Error e) {
critical("Couldn't write to STDIN of SSH command. Error: %s", e.message);
#if VALA_0_40
Posix.kill(this.pid, Posix.Signal.TERM);
#else
Posix.kill(this.pid, Posix.SIGTERM);
#endif
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment