Fix file writing shell command

This commit is contained in:
Christopher Schnick 2022-11-24 06:21:41 +01:00
parent 5e8dd42dd9
commit 2dabc02a3c
3 changed files with 8 additions and 8 deletions

View file

@ -29,7 +29,7 @@ public interface MachineStore extends FileSystemStore, ShellStore {
@Override
public default OutputStream openOutput(String file) throws Exception {
return create().commandListFunction(proc -> proc.getShellType().createFileWriteCommand(proc.getOsType().normalizeFileName(file)))
return create().commandFunction(proc -> proc.getShellType().createFileWriteCommand(proc.getOsType().normalizeFileName(file)))
.startExternalStdin();
}

View file

@ -43,7 +43,7 @@ public interface ShellType {
List<String> createFileReadCommand(String file);
List<String> createFileWriteCommand(String file);
String createFileWriteCommand(String file);
List<String> createFileExistsCommand(String file);

View file

@ -117,8 +117,8 @@ public class ShellTypes {
}
@Override
public List<String> createFileWriteCommand(String file) {
return List.of("findstr", "\"^\"", ">", file);
public String createFileWriteCommand(String file) {
return "findstr \"^\" > \"" + file + "\"";
}
@Override
@ -233,8 +233,8 @@ public class ShellTypes {
}
@Override
public List<String> createFileWriteCommand(String file) {
return List.of("cmd", "/c", "findstr", "\"^\"", ">", file);
public String createFileWriteCommand(String file) {
return "cmd /c 'findstr \"^\" > \"" + file + "\"'";
}
@Override
@ -351,8 +351,8 @@ public class ShellTypes {
}
@Override
public List<String> createFileWriteCommand(String file) {
return List.of("cat", ">", file);
public String createFileWriteCommand(String file) {
return "cat > \"" + file + "\"";
}
@Override