From 323711f447b23093f2e9d351c7a8cf92b7822377 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Tue, 20 May 2014 14:33:27 +0000 Subject: [PATCH] 2014-05-20 Ramon Novoa * bin/pandora_server: Stop the service when the server crashes (win32). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9963 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 4 ++++ pandora_server/bin/pandora_server | 14 +++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 32db104734..2ab05e6a4e 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,7 @@ +2014-05-20 Ramon Novoa + + * bin/pandora_server: Stop the service when the server crashes (win32). + 2014-05-13 Ramon Novoa * bin/pandora_server: Added support to run as a native win32 service. diff --git a/pandora_server/bin/pandora_server b/pandora_server/bin/pandora_server index ed951a1636..3570c965bf 100755 --- a/pandora_server/bin/pandora_server +++ b/pandora_server/bin/pandora_server @@ -148,6 +148,8 @@ sub pandora_crash () { # worried about that. If perl has a more "clean" way to avoid this messages # will be nice to replace this code, but at this time it's the only way I know + callback_stop() if (defined($Config{'__win32_service__'})); + foreach my $error_line (@_) { # Trap the XML error and exit without nasty messages if ($error_line =~ m/XML\/Parser/) { @@ -471,7 +473,7 @@ sub parse_options { } elsif ($service_action eq 'uninstall') { win32_uninstall_service(); } elsif ($service_action eq 'run') { - win32_service_run; + $Config{'__win32_service__'} == 1; } else { error("Unknown action: $service_action"); } @@ -622,8 +624,14 @@ sub main() { } # Parse command line options. -parse_options; +parse_options(); # Run as a regular process. -main(); +if (!defined($Config{'__win32_service__'})) { + main(); +} +# Run as a Windows service. +else { + win32_service_run(); +}