mirror of
https://github.com/xpipe-io/xpipe.git
synced 2024-11-22 07:30:24 +00:00
Partially revert no init script changes for terminals
This commit is contained in:
parent
4bf42831f3
commit
f064efaa29
1 changed files with 8 additions and 13 deletions
|
@ -35,7 +35,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String toCommand(String name, String file) {
|
protected String toCommand(String name, String file) {
|
||||||
return "-ExecutionPolicy Bypass -NoProfile -Command " + noInit(file);
|
return "-ExecutionPolicy Bypass -NoProfile -Command cmd /C '" + file + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -49,8 +49,8 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
@Override
|
@Override
|
||||||
protected String toCommand(String name, String file) {
|
protected String toCommand(String name, String file) {
|
||||||
// Fix for https://github.com/PowerShell/PowerShell/issues/18530#issuecomment-1325691850
|
// Fix for https://github.com/PowerShell/PowerShell/issues/18530#issuecomment-1325691850
|
||||||
var script = ScriptHelper.createLocalExecScript("set \"PSModulePath=\"\r\n\"" + noInit(file) + "\"\npause");
|
var script = ScriptHelper.createLocalExecScript("set \"PSModulePath=\"\r\n\"" + file + "\"\npause");
|
||||||
return "-ExecutionPolicy Bypass -NoProfile -Command " + noInit(script);
|
return "-ExecutionPolicy Bypass -NoProfile -Command cmd /C '" +script + "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -68,7 +68,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
// backslash of a filepath to escape the closing quote in the title argument
|
// backslash of a filepath to escape the closing quote in the title argument
|
||||||
// So just remove that slash
|
// So just remove that slash
|
||||||
var fixedName = FileNames.removeTrailingSlash(name);
|
var fixedName = FileNames.removeTrailingSlash(name);
|
||||||
return "-w 1 nt --title \"" + fixedName + "\" " + noInit(file);
|
return "-w 1 nt --title \"" + fixedName + "\" \"" + file + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -89,7 +89,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
// In order to fix this bug which also affects us:
|
// In order to fix this bug which also affects us:
|
||||||
// https://askubuntu.com/questions/1148475/launching-gnome-terminal-from-vscode
|
// https://askubuntu.com/questions/1148475/launching-gnome-terminal-from-vscode
|
||||||
toExecute =
|
toExecute =
|
||||||
"GNOME_TERMINAL_SCREEN=\"\" nohup " + noInit(file) + " </dev/null &>/dev/null & disown";
|
"GNOME_TERMINAL_SCREEN=\"\" nohup " + toExecute + " </dev/null &>/dev/null & disown";
|
||||||
pc.executeSimpleCommand(toExecute);
|
pc.executeSimpleCommand(toExecute);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -109,7 +109,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String toCommand(String name, String file) {
|
protected String toCommand(String name, String file) {
|
||||||
return "--new-tab -e " + noInit(file);
|
return "--new-tab -e \"" + file + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -122,7 +122,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String toCommand(String name, String file) {
|
protected String toCommand(String name, String file) {
|
||||||
return "--tab --title \"" + name + "\" --command " + noInit(file);
|
return "--tab --title \"" + name + "\" --command \"" + file + "\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -164,10 +164,6 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
|
|
||||||
public abstract void launch(String name, String file, boolean elevated) throws Exception;
|
public abstract void launch(String name, String file, boolean elevated) throws Exception;
|
||||||
|
|
||||||
default String noInit(String file) {
|
|
||||||
return ShellDialects.getPlatformDefault().executeWithNoInitFiles(ShellDialects.getPlatformDefault(), file);
|
|
||||||
}
|
|
||||||
|
|
||||||
static class MacOsTerminalType extends ExternalApplicationType.MacApplication implements ExternalTerminalType {
|
static class MacOsTerminalType extends ExternalApplicationType.MacApplication implements ExternalTerminalType {
|
||||||
|
|
||||||
public MacOsTerminalType() {
|
public MacOsTerminalType() {
|
||||||
|
@ -236,7 +232,6 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void launch(String name, String file, boolean elevated) throws Exception {
|
public void launch(String name, String file, boolean elevated) throws Exception {
|
||||||
var toExecute = noInit(file).replaceAll("\"", "\\\\\"");
|
|
||||||
try (ShellControl pc = LocalStore.getShell()) {
|
try (ShellControl pc = LocalStore.getShell()) {
|
||||||
var cmd = String.format(
|
var cmd = String.format(
|
||||||
"""
|
"""
|
||||||
|
@ -257,7 +252,7 @@ public interface ExternalTerminalType extends PrefsChoiceValue {
|
||||||
end tell
|
end tell
|
||||||
end if
|
end if
|
||||||
EOF""",
|
EOF""",
|
||||||
toExecute, toExecute);
|
file.replaceAll("\"", "\\\\\""), file.replaceAll("\"", "\\\\\""));
|
||||||
pc.executeSimpleCommand(cmd);
|
pc.executeSimpleCommand(cmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue