summaryrefslogtreecommitdiffstats
path: root/perl-install/any.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/any.pm')
-rw-r--r--perl-install/any.pm19
1 files changed, 19 insertions, 0 deletions
diff --git a/perl-install/any.pm b/perl-install/any.pm
index 5210a30f3..ccc68723d 100644
--- a/perl-install/any.pm
+++ b/perl-install/any.pm
@@ -1023,6 +1023,25 @@ sub ask_window_manager_to_logout {
1;
}
+sub ask_window_manager_to_logout_then_do {
+ my ($wm, $pid, $action) = @_;
+ if (fork()) {
+ any::ask_window_manager_to_logout($wm);
+ return;
+ }
+
+ open STDIN, "</dev/zero";
+ open STDOUT, ">/dev/null";
+ open STDERR, ">&STDERR";
+ c::setsid();
+ exec 'perl', '-e', q(
+ my ($wm, $pid) = @ARGV;
+ my $nb;
+ for ($nb = 30; $nb && -e "/proc/$pid"; $nb--) { sleep 1 }
+ system($action) if $nb;
+ ), $wm, $pid;
+}
+
sub alloc_raw_device {
my ($prefix, $device) = @_;
my $used = 0;