Closed IsaiahGrace closed 2 months ago
@IsaiahGrace I think this is because that an async process, but need to check. Maybe @chrisant996 knows what's going on here.
@JanDeDobbeleer does oh-my-posh use a temp file to cache previous prompt state?
Maybe it's not qualifying the temp file name, and all windows are sharing the same temp file?
@chrisant996 it's a session guid so that should "work", I can check though. Maybe on cmd that's not working as expected. It's a bit of a different animal 😅
Where does the session guid come from? There's no such thing in Windows. There's a Windows Terminal session guid, but it's an environment variable and is probably about the terminal session, not the CMD session.
You probably need to use the CMD process ID instead.
Where does the session guid come from?
@chrisant996 it's generated here. Should be unique, and that's also how we cache the prompt data and retrieve it with that key when generating the transient prompt.
It's behaving like the temp file is "bleeding through" between CMD processes.
I can take a closer look sometime next week if it hasn't been figured out by then.
(Clink isn't doing it, btw. This is happening in the custom prompt script.)
@chrisant996 check, I already figured out that the environment variable is shared across the shells. So that's the issue.
Oh wait a minute. It's using math.random
, so it's pseudo random. That's not really a guid.
Have you tested to make sure it isn't picking the same random number the first time each session tries to get a guid?
I think you need to at a minimum seed the pseudo random number generator with os.clock() * 10000
(ten thousand).
@chrisant996 yup, it generates the same thing every time. You mentioned
You probably need to use the CMD process ID instead.
which might be the most straightforward solution.
Thanks for the fix! I was going to just live with the strange behavior, but I'm glad I posted the bug! I upgraded to 21.17.1 and everything is looking good.
@IsaiahGrace always post the bug 😄. And thanks @chrisant996 for being my rubber duck here 🙏🏻
@holopin-bot @chrisant996 helping
Congratulations @chrisant996, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/clxz7ce6u29910cl6rtfladm7
This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account. Or if you're new to Holopin, you can simply sign up with GitHub, which will do the trick!
Code of Conduct
What happened?
I'm using cmd + clink on Windows 11. I noticed that after switching terminal windows, the transient prompt will print the path of the previous window once before reverting to the correct value. It seems like the value used to print the path in the transient prompt is not updated at the correct time.
Theme
I'm using a slightly modified version of this theme: https://github.com/dreamsofautonomy/zen-omp/blob/main/zen.toml
What OS are you seeing the problem on?
Windows
Which shell are you using?
cmd
Log output