Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing commands in n pwsh in parallel can cause problems with history #226934

Closed
dbaeumer opened this issue Aug 28, 2024 · 6 comments
Closed
Assignees
Labels
info-needed Issue requires more information from poster *out-of-scope Posted issue is not in scope of VS Code

Comments

@dbaeumer
Copy link
Member

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.

@Tyriar
Copy link
Member

Tyriar commented Aug 28, 2024

@dbaeumer was this in the terminal (pwsh's problem) or in devtools (our problem)?

@Tyriar Tyriar added the info-needed Issue requires more information from poster label Aug 28, 2024
@dbaeumer
Copy link
Member Author

I tested #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.

@Tyriar
Copy link
Member

Tyriar commented Aug 29, 2024

@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.

@dbaeumer
Copy link
Member Author

@Tyriar I see the problem printed in the terminal.

Copy link

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!

@vs-code-engineering vs-code-engineering bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 6, 2024
@Tyriar
Copy link
Member

Tyriar commented Sep 6, 2024

In that case it's that powershell isn't good at dealing with multiple writes to the history file. fyi @daxian-dbw

@Tyriar Tyriar added the *out-of-scope Posted issue is not in scope of VS Code label Sep 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster *out-of-scope Posted issue is not in scope of VS Code
Projects
None yet
Development

No branches or pull requests

2 participants