mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-08-13 13:01:02 +00:00
Fix file writing shell command
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user