summaryrefslogtreecommitdiffstats
path: root/perl-install/any.pm
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-02-18 17:35:17 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-02-18 17:35:17 +0000
commit3ce35b6a36bd75410c11af5e804a08f7d5650aa8 (patch)
tree5ae179989ea0f261fd5d91cb822fe6a452617f59 /perl-install/any.pm
parentaa6398654727a7ebc408f50520fe6ae3266ae27b (diff)
downloaddrakx-3ce35b6a36bd75410c11af5e804a08f7d5650aa8.tar
drakx-3ce35b6a36bd75410c11af5e804a08f7d5650aa8.tar.gz
drakx-3ce35b6a36bd75410c11af5e804a08f7d5650aa8.tar.bz2
drakx-3ce35b6a36bd75410c11af5e804a08f7d5650aa8.tar.xz
drakx-3ce35b6a36bd75410c11af5e804a08f7d5650aa8.zip
factorize code in ask_window_manager_to_logout_then_do()
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;