Executing commands in n pwsh in parallel can cause problems with history
Testing #226655
Got the following error when executing commands in two pwsh processes in parallel
Error reading or writing history file 'C:\xxx\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt': The process cannot access the file 'C:\xxx\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadline\ConsoleHost_history.txt' because it is being used by another process.
I could build my own queue and use start / stop events to drain the queue. But may be a waitUntilDone(): Promise<number> on the TerminalShellExecution returned from executeCommand would ease that.
@dbaeumer was this in the terminal (pwsh's problem) or in devtools (our problem)?
I tested https://github.com/microsoft/vscode/issues/226655 and executed two commands using TerminalShellIntegration#executeCommand. The two pwsh shells execute them in parallel and both try to modify the history. It is not necessarily a bug in our code, however it is not easy to synchronize the execution with the API we provide.
@dbaeumer I mean do you see the error printed in the terminal or in the debugger/devtools console? If it's the former it would be a bug I need to report to the powershell team.
@Tyriar I see the problem printed in the terminal.
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines.
Happy Coding!
In that case it's that powershell isn't good at dealing with multiple writes to the history file. fyi @daxian-dbw