acomagu / fish-async-prompt

Make your prompt asynchronous to improve the reactivity.
MIT License
390 stars 22 forks source link

Made compatible with Mac OSX #4

Closed mec07 closed 5 years ago

mec07 commented 5 years ago

There were a couple of commands that made this plugin incompatible with Mac OSX. They should be fixed by this commit. It seems to be working fine with these minor alterations.

mec07 commented 5 years ago

Unfortunately I still seem to be getting <W> fish: Locking the universal var file took too long (0.577 seconds). every now and then. I can't really reproduce it reliably -- it just seems to happen randomly.

acomagu commented 5 years ago

Thank you for your PR!(I didn't know that macOS don't have procfs)

As #2 pointed out, the Fish of current master branch(gdfe6bc5) don't have %self notation. ref. https://github.com/fish-shell/fish-shell/issues/4230 We have a choice to support only released versions(not to support upstream version), but I want to support both of them if possible. So the another way to get self PID on macOS is needed. Do you have any idea?

mec07 commented 5 years ago

Hi, sorry, I posted in the issue, when I should have posted here. I'll just quote it again:

Thanks. I've had a look at the fish github and I think you'll find this interesting: https://github.com/fish-shell/fish-shell/blob/786c0c5abb936eeb10eae45b508132a313bc8abc/CHANGELOG.md#notable-non-backward-compatible-changes

Perhaps we could just make the function check the new format $fish_pid and if that is empty then return the old format %self. I'll update the PR.

mec07 commented 5 years ago

@acomagu Let's decide whether to merge this PR or to decline it. I'm currently running my prompt using this code and have been since I submitted it 6 days ago. Perhaps you could just verify that it's OK on Linux and with bleeding edge fish?

mec07 commented 5 years ago

I uploaded another commit. I think it could help with matters, but unfortunately it doesn't fix the error: <W> fish: Locking the universal var file took too long (1.004 seconds). I think that error is caused by too many threads waiting on the universal file lock: https://github.com/fish-shell/fish-shell/blob/master/src/env_universal_common.cpp#L569

mec07 commented 5 years ago

There must be a way to catch the error: <W> fish: Locking the universal var file took too long (0.254 seconds). so it doesn't keep popping up. It's really annoying. Any ideas @acomagu ?

acomagu commented 5 years ago

I really sorry for my late reply... I checked the diff and it worked completely on my Linux env.

Thank you so much for your work! I'll merge it.