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 c9aa4bdcf4b182aef1472790b0071b90feed4573..7b6a70736bf248cded2e53657adae6db2cfd6bef 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