Error writing to history when broadcasting input to multiple terminals
See original GitHub issueEnvironment data
PS version: 6.0.4
PSReadline version: 2.0.0-beta2
OS: Windows 10, Version 1703 (Build 15063.1209)
Steps to reproduce or exception report
- Open multiple instances of PowerShell in a terminal emulator which supports split panes and broadcasts (e.g.: ConEmu)
- Open three splits, resulting in four total open panes.
- Turn on broadcasting (ctrl+shift+G for ConEmu)
- Enter a command such as
ls
and press the Enter key.
Expected behavior
The command runs in all panes and no error is thrown
Actual behavior
The command runs in all panes, but errors will be thrown stating that the history file could not be written to because it is being used by another process
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Preserve bash history in multiple terminal windows
Because when PROMPT_COMMAND is executed the history from all other Bash sessions are integrated in the history of the current session.
Read more >Broadcast input to several terminals
As I see it, it seems relatively simple, it sends the input you send to one terminal to all others. How would you...
Read more >Support broadcast input? · Issue #2634 · microsoft/terminal
Hey just as a feeler for folks following in this thread - How much demand is there for broadcasting to a subset of...
Read more >Bash history handling with multiple terminals
I tried with export PROMPT_COMMAND='history -a; history -r' and I got some strange history line numbers in terminal - after issuing some command ......
Read more >How to send a command to all panes in tmux?
Have you tried following in tmux window with multiple panes. Ctrl-B : setw synchronize-panes on clear history.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
In theory, the retry logic is already implemented, see here.
Based on the error, it seems like something is holding on to the file handle outside the mutex - so either I’m missing a using statement, or there is a side effect accessing the file that missed.
This also happens when you programmatically open two terminals at the same time. This can be done with the “Terminals Manager” extension of VSCode, for example. You just configure two or more terminals and “Run Terminals” It will then throw
Error reading or writing history file 'C:\Users\...\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt': The process cannot access the file 'C:\Users\...\AppData\Roaming\Microsoft\Windows\PowerShell\PSReadLine\ConsoleHost_history.txt' because it is being used by another process.