mirror of
https://github.com/xpipe-io/xpipe.git
synced 2026-08-11 20:11:00 +00:00
Shell fixes
This commit is contained in:
@@ -26,8 +26,16 @@ public interface CommandControl extends ProcessControl {
|
||||
|
||||
CommandControl complex();
|
||||
|
||||
CommandControl notComplex();
|
||||
|
||||
CommandControl workingDirectory(String directory);
|
||||
|
||||
default void execute() throws Exception {
|
||||
try (var c = start()) {
|
||||
c.discardOrThrow();
|
||||
}
|
||||
}
|
||||
|
||||
ShellControl getParent();
|
||||
|
||||
InputStream startExternalStdout() throws Exception;
|
||||
|
||||
@@ -13,6 +13,8 @@ import java.util.stream.Stream;
|
||||
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type")
|
||||
public interface ShellDialect {
|
||||
|
||||
CommandControl createStreamFileWriteCommand(ShellControl shellControl, String file);
|
||||
|
||||
default String getCdCommand(String directory){
|
||||
return "cd \"" + directory + "\"";
|
||||
}
|
||||
@@ -101,9 +103,7 @@ public interface ShellDialect {
|
||||
|
||||
String getFileMoveCommand(String oldFile, String newFile);
|
||||
|
||||
CommandControl getStreamFileWriteCommand(ShellControl processControl, String file);
|
||||
|
||||
String getTextFileWriteCommand(String content, String file);
|
||||
CommandControl createTextFileWriteCommand(ShellControl parent, String content, String file);
|
||||
|
||||
String getFileDeleteCommand(String file);
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ public class ConnectionFileSystem implements FileSystem {
|
||||
@Override
|
||||
public OutputStream openOutput(String file) throws Exception {
|
||||
return shellControl.getShellDialect()
|
||||
.getStreamFileWriteCommand(shellControl, shellControl.getOsType().normalizeFileName(file))
|
||||
.createStreamFileWriteCommand(shellControl, shellControl.getOsType().normalizeFileName(file))
|
||||
.startExternalStdin();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user