Various fixes

This commit is contained in:
crschnick
2023-08-16 16:49:11 +00:00
parent 11293012e1
commit a938f23a81
7 changed files with 62 additions and 10 deletions
@@ -161,6 +161,8 @@ public interface ShellDialect {
CommandControl deleteFileOrDirectory(ShellControl sc, String file);
String clearDisplayCommand();
CommandControl createFileExistsCommand(ShellControl sc, String file);
CommandControl symbolicLink(ShellControl sc, String linkFile, String targetFile);
@@ -92,7 +92,9 @@ public class ConnectionFileSystem implements FileSystem {
@Override
public void delete(String file) throws Exception {
try (var pc = shellControl.getShellDialect().deleteFileOrDirectory(shellControl, file)
try (var pc = shellControl
.getShellDialect()
.deleteFileOrDirectory(shellControl, file)
.start()) {
pc.discardOrThrow();
}
@@ -139,14 +141,21 @@ public class ConnectionFileSystem implements FileSystem {
@Override
public void symbolicLink(String linkFile, String targetFile) throws Exception {
try (var pc = shellControl.getShellDialect().symbolicLink(shellControl,linkFile, targetFile)
try (var pc = shellControl
.getShellDialect()
.symbolicLink(shellControl, linkFile, targetFile)
.start()) {
pc.discardOrThrow();
}
}
@Override
public void close() throws IOException {
shellControl.close();
public void close() {
// In case the shell control is already in an invalid state, this operation might fail
// Since we are only closing, just swallow all exceptions
try {
shellControl.close();
} catch (IOException ignored) {
}
}
}