changeset 2477:0a1bb03d407c

Windows - change invocation of thermostat-command-channel thermostat-command-channel is a shell script, so must be called appropriately on Windows. (also includes a fix to a copyright date on CommandChannerDelegate.java) Reviewed-by: sgehwolf Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2016-October/021256.html
author Simon Tooke <stooke@redhat.com>
date Thu, 13 Oct 2016 15:09:54 -0400
parents da549e428ff5
children 097cf8492c2f
files agent/command/src/main/java/com/redhat/thermostat/agent/command/internal/CommandChannelDelegate.java distribution/windows/config/thermostatrc.cmd
diffstat 2 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/agent/command/src/main/java/com/redhat/thermostat/agent/command/internal/CommandChannelDelegate.java	Thu Oct 13 15:02:25 2016 -0400
+++ b/agent/command/src/main/java/com/redhat/thermostat/agent/command/internal/CommandChannelDelegate.java	Thu Oct 13 15:09:54 2016 -0400
@@ -72,6 +72,8 @@
     private static final Logger logger = LoggingUtils.getLogger(CommandChannelDelegate.class);
     private static final String CMD_NAME = "thermostat-command-channel";
     private static final String IPC_SERVER_NAME = "command-channel";
+    private static final boolean IS_UNIX = !System.getProperty("os.name").contains("Windows");
+
     // States for 'state' field
     private static final int STATE_NOT_STARTED = 0;
     private static final int STATE_STARTED = 1;
@@ -205,8 +207,12 @@
     }
     
     private void startServer(String hostname, int port) throws IOException {
-        String[] processArgs = { binPath.getAbsolutePath() + File.separator + CMD_NAME, hostname, 
-                String.valueOf(port), ipcConfig.getAbsolutePath() };
+        String[] processArgs = IS_UNIX
+                ? new String[]{ binPath.getAbsolutePath() + File.separator + CMD_NAME, hostname,
+                                String.valueOf(port), ipcConfig.getAbsolutePath() }
+                : new String[] { "cmd", "/c", binPath.getAbsolutePath() + File.separator + CMD_NAME + ".cmd", hostname,
+                                String.valueOf(port), ipcConfig.getAbsolutePath() };
+
         ProcessBuilder builder = new ProcessBuilder(processArgs);
         // This has the problem of some messages/Exceptions not
         // showing up in the parent's stderr stream if used together
--- a/distribution/windows/config/thermostatrc.cmd	Thu Oct 13 15:02:25 2016 -0400
+++ b/distribution/windows/config/thermostatrc.cmd	Thu Oct 13 15:09:54 2016 -0400
@@ -1,6 +1,6 @@
 @echo off
 ::
-:: Copyright 2012-2015 Red Hat, Inc.
+:: Copyright 2012-2016 Red Hat, Inc.
 ::
 :: This file is part of Thermostat.
 ::