File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -198,9 +198,10 @@ private static function create_prompt_cmd( $prompt, $history_path ) {
198198 if ( $ is_powershell ) {
199199 // PowerShell uses ` (backtick) for escaping but for strings single quotes are literal.
200200 // If prompt contains single quotes, we double them in PowerShell.
201- $ prompt_for_ps = str_replace ( "' " , "'' " , $ prompt );
202- $ cmd = "\$line = Read-Host -Prompt ' {$ prompt_for_ps }'; Write-Output \$line; " ;
203- return "powershell.exe -NoProfile -Command \"{$ cmd }\"" ;
201+ $ prompt_for_ps = str_replace ( "' " , "'' " , $ prompt );
202+ $ history_path_for_ps = str_replace ( "' " , "'' " , $ history_path );
203+ $ cmd = "\$line = Read-Host -Prompt ' {$ prompt_for_ps }'; if ( \$line ) { Add-Content -Path ' {$ history_path_for_ps }' -Value \$line; } Write-Output \$line; " ;
204+ return "powershell.exe -Command \"{$ cmd }\"" ;
204205 }
205206
206207 if ( ! is_file ( $ shell_binary ) || ! is_readable ( $ shell_binary ) ) {
You can’t perform that action at this time.
0 commit comments