Skip to content

Commit

Permalink
More elevation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
crschnick committed Mar 8, 2023
1 parent 872406f commit 90ce2de
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/src/main/java/io/xpipe/app/util/ScriptHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,18 @@ private static String createExecScript(ShellControl processControl, String file,
return file;
}

@SneakyThrows
public static String createAskPassScript(SecretValue pass, ShellControl parent, ShellDialect type) {
public static String createAskPassScript(SecretValue pass, ShellControl parent) throws Exception {
var scriptType = parent.getShellDialect();

// Fix for power shell as there are permission issues when executing a powershell askpass script
if (parent.getShellDialect().equals(ShellDialects.POWERSHELL)) {
scriptType = parent.getOsType().equals(OsType.WINDOWS) ? ShellDialects.CMD : ShellDialects.BASH;
}

return createAskPassScript(pass, parent, scriptType);
}

private static String createAskPassScript(SecretValue pass, ShellControl parent, ShellDialect type) throws Exception {
var content = type.getScriptEchoCommand(pass.getSecretValue());
var temp = parent.getTemporaryDirectory();
var file = FileNames.join(temp, "askpass-" + getScriptId() + "." + type.getScriptFileEnding());
Expand Down

0 comments on commit 90ce2de

Please sign in to comment.