Skip to content

Commit

Permalink
Use -NoProfile flag ans remove the patch used to clear buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
profesorfalken authored and Javier Garcia committed Feb 7, 2019
1 parent a49a360 commit 6e6e8df
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/main/java/com/profesorfalken/jpowershell/PowerShell.java
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ private PowerShell initalize(String powerShellExecutablePath) throws PowerShellN
//Start powershell executable in process
if (OSDetector.isWindows()) {
pb = new ProcessBuilder("cmd.exe", "/c", "chcp", codePage, ">", "NUL", "&", powerShellExecutablePath,
"-ExecutionPolicy", "Bypass", "-NoExit", "-Command", "-");
"-ExecutionPolicy", "Bypass", "-NoExit", "-NoProfile", "-Command", "-");
} else {
pb = new ProcessBuilder(powerShellExecutablePath, "-nologo", "-noexit", "-Command", "-");
}
Expand All @@ -164,9 +164,6 @@ private PowerShell initalize(String powerShellExecutablePath) throws PowerShellN
// Init thread pool. 2 threads are needed: one to write and read console and the other to close it
this.threadpool = Executors.newFixedThreadPool(2);

//Clean output stream to avoid init profile messages
clearOutput();

//Get and store the PID of the process
this.pid = getPID();

Expand Down Expand Up @@ -474,9 +471,4 @@ private long getPID() {

return -1;
}

//Call null command in order to clear the output stream
private void clearOutput() {
executeCommand("$null").getCommandOutput();
}
}

0 comments on commit 6e6e8df

Please sign in to comment.