Changeset 8964


Ignore:
Timestamp:
11/28/12 12:11:42 (10 years ago)
Author:
ascheibe
Message:

#1986 fixed calling the shutdown command from a windows service

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Clients.Hive.Slave/3.3/Core.cs

    r8957 r8964  
    2222using System;
    2323using System.Diagnostics;
     24using System.IO;
     25using System.Reflection;
    2426using System.ServiceModel;
    2527using System.Threading;
     
    456458      t.ContinueWith(c => {
    457459        try {
    458           Process.Start(SlaveCore.Properties.Settings.Default.ShutdownCommand);
     460          //we assume that *.exe means an executable in the current directory, otherwise it is a command
     461          if (SlaveCore.Properties.Settings.Default.ShutdownCommand.EndsWith(".exe")) {
     462            string dirName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
     463            Process.Start(Path.Combine(dirName, SlaveCore.Properties.Settings.Default.ShutdownCommand));
     464          } else {
     465            Process.Start(SlaveCore.Properties.Settings.Default.ShutdownCommand);
     466          }
    459467        }
    460468        catch (Exception ex) {
Note: See TracChangeset for help on using the changeset viewer.