From c54f5f5b0f9fb7a2e6b795227d3679651ecd386e Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Mon, 10 Apr 2006 13:48:05 +0000 Subject: fix restarting old applets by providing them the right DISPLAY --- migrate-mdvonline-applet.pl | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'migrate-mdvonline-applet.pl') diff --git a/migrate-mdvonline-applet.pl b/migrate-mdvonline-applet.pl index a194bd20..ca666398 100755 --- a/migrate-mdvonline-applet.pl +++ b/migrate-mdvonline-applet.pl @@ -22,6 +22,7 @@ use lib qw(/usr/lib/libDrakX); use standalone; # for explanations +use MDK::Common; my $run_file = '/var/run/mdkapplet'; @@ -50,10 +51,13 @@ if ($mode eq 'new') { my ($pid, $user, $cmd) = /^\s*(\d+)\s*(\S*)\s*(.*)$/; # do not match su running mdkapplet: next if $cmd !~ /perl.*mdkapplet/; + my ($DISPLAY) = grep { /^DISPLAY=/ } split('\0', cat_("/proc/$pid/environ")); + $DISPLAY =~ s/^DISPLAY=//; log::explanations(qq(killing "$cmd" (pid=$pid))); kill 15, $pid; my $pid2 = fork(); if (defined $pid2) { + local $ENV{DISPLAY} = $DISPLAY; !$pid2 and do { exec('su', $user, '-c', 'mdkapplet --auto-update') or do { require POSIX; POSIX::_exit() } }; log::explanations("restarting applet (pid=$pid2)"); } else { -- cgit v1.2.1