From aa3e7d6a6d123d98a150a52e09cea675b6732f08 Mon Sep 17 00:00:00 2001
From: ribeaudc <ribeaudc>
Date: Fri, 16 May 2008 06:09:29 +0000
Subject: [PATCH] change: - Add '-T' option to ssh.

SVN: 6086
---
 .../highwatermark/RemoteFreeSpaceProvider.java      | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/common/source/java/ch/systemsx/cisd/common/highwatermark/RemoteFreeSpaceProvider.java b/common/source/java/ch/systemsx/cisd/common/highwatermark/RemoteFreeSpaceProvider.java
index c9aa4bdcf4b..7b6a70736bf 100644
--- a/common/source/java/ch/systemsx/cisd/common/highwatermark/RemoteFreeSpaceProvider.java
+++ b/common/source/java/ch/systemsx/cisd/common/highwatermark/RemoteFreeSpaceProvider.java
@@ -39,6 +39,8 @@ import ch.systemsx.cisd.common.process.ProcessResult;
  */
 public final class RemoteFreeSpaceProvider implements IFreeSpaceProvider
 {
+    private static final char SPACE = ' ';
+
     private static final String DF_COMMAND_TEMPLATE = "df -k %s";
 
     private static final Logger machineLog =
@@ -92,24 +94,25 @@ public final class RemoteFreeSpaceProvider implements IFreeSpaceProvider
         final String path = file.getPath();
         assert StringUtils.isNotEmpty(path) : "Empty path.";
         final String dfCommand = String.format(DF_COMMAND_TEMPLATE, path);
-        final List<String> command = Arrays.asList(sshExecutable.getPath(), host, dfCommand);
+        final List<String> command = Arrays.asList(sshExecutable.getPath(), "-T", host, dfCommand);
         final ProcessResult processResult =
                 ProcessExecutionHelper.run(command, millisToWaitForCompletion, operationLog,
                         machineLog);
         processResult.log();
         final List<String> processOutput = processResult.getProcessOutput();
+        final String commandLine = StringUtils.join(processResult.getCommandLine(), SPACE);
         if (processOutput.size() >= 2)
         {
             final String output = processOutput.get(1);
-            final String[] split = StringUtils.split(output, ' ');
+            final String[] split = StringUtils.split(output, SPACE);
             if (split.length >= 4)
             {
                 // The column 'avail' (3th column) interests us.
-                return parseKbytes(split[3], dfCommand);
+                return parseKbytes(split[3], commandLine);
             }
         }
         throw new IOException(String.format(
-                "Command line '%s' did not return info as expected. Response was '%s'", dfCommand,
-                processOutput));
+                "Command line '%s' did not return info as expected. Response was '%s'",
+                commandLine, processOutput));
     }
 }
\ No newline at end of file
-- 
GitLab