jaspernbrouwer / powerline-gitstatus

A Powerline segment for showing the status of a Git working copy
MIT License
383 stars 53 forks source link

Segment not showing up with powerline-daemon #1

Closed Bensge closed 9 years ago

Bensge commented 9 years ago

Hello, I've been using your segment for a few days now and it's great! However, I noticed that it just doesn't show up when I'm using the powerline-daemon to speed up powerline. This is very unfortunate because powerline is unbearably slow without the daemon. I have followed your install instructions carefully. I also tried copying the python files to ~/.config/powerline/segments/ and ~/Library/Python/2.7/lib/python/site-packages/powerline_gitstatus/ as well as adjusting the segment configuration to the following:

{
  "function": "powerline_gitstatus.gitstatus",
  "module": "powerline_gitstatus.segments",
  "priority": 40
},

However, the segment still just doesn't show up when using the powerline-daemon. As soon as I kill the daemon and powerline uses local processing, or if I let the server run in the foreground (powerline-daemon --forground) the segment is there again. Do you have any tips to get your segment to work with the daemon? Any help appreciated

Cheers, Benno

jaspernbrouwer commented 9 years ago

Hi Benno,

Thanx for showing interest in this segment!

Unfortunately I don't really have an answer for you :( I'm fairly new to Powerline and haven't fully grasped all the ins and outs of its internals.

When I started I switched from Bash to ZSH, and noticed that using powerline-daemon or not didn't make any difference for me. Both weren't exactly slow, but still a bit sluggish. All I did to enable the daemon was start it before loading powerline.zsh (like it's shown here). I was unable to determine if the daemon was actually used, but I didn't spend much time on that.

In stead I switched to using libzpython, and that was an instant win! All sluggishness was gone. If you're also using ZSH, I can definitely recommend to go this was (you won't need the daemon).

In all cases, the segment showed up just fine, so I cannot say why it's not showing up for you.

Bensge commented 9 years ago

At first, when I tried to use the powerline-daemon, I didn't notice any difference either, I suspect the daemon was simply not used. However, now I can see a significant performance increase when using the daemon. I am using Bash, and I couldn't find a lot of info on libzpython. Can you point me in the right direction? About the original issue, I think it has to do with the program environment, the only difference between the daemon running foreground and background is the process, standard in-out streams and therfore the program environment. I suppose the daemon fails to load the segment and logs the errors to /dev/null. I tried removing the segment from my python folder and saw error logs from powerline (foreground, that is). The behavior was exactly the same as the daemon - The git segment is simply missing. EDIT: Another possibility is that your segment crashes or fails to execute in the daemon environment, producing no visible errors because those get logged to /dev/null by the background daemon

23maverick23 commented 9 years ago

@Bensge I can reproduce this exact behavior on my machine as well. I run powerline with the powerline-daemon -q option, and with the most recent update of powerline, this plugin segment disappears. When I run powerline-daemon -k, the plugin nearly instantly reappears. I'm running this on OS X in iTerm2 using the fish shell, in case that helps.

I did a bit of "hacky" testing on a copy of the segments.py file, and it appears that when using the daemon, this plugin isn't even being called (not sure how/why that would be). Might be worth asking the folks over at powerline, as I noticed that they made a few (minor?) changes to powerline-daemon.py with the 2.1 Release. Specifically, they updated how they handle encoding.

jaspernbrouwer commented 9 years ago

So it could be I'm still on an older version of Powerline. I'll upgrade and run some tests when I can find some time.

Thanks for the feedback!

Bensge commented 9 years ago

I just tried downgrading powerline and discovered some interesting things. Firstly, the powerline-gitstatus segment seems to work with the powerline daemon in version 2.0 of powerline. However, I don't notice any performance improvements from the daemon over the standalone client, unlike in powerline 2.1. I tested that with and without the custom git segment and the git segment is not the origin of that problem. I have the impression that the daemon isn't used at all in < 2.1. I think we should create and issue over at the main powerline repo and link this specific issue. Btw: you can install older versions of powerline with this command (if you installed it with pip): pip install --user git+git://github.com/powerline/powerline@2.0

jaspernbrouwer commented 9 years ago

@Bensge That was exactly the impression I got as well, no performance boost, that's why I switched to libzpython.

If you want to open an issue at Powerline, go ahead, but by the sound of it I suspect they'll respond with something in the line of "we fixed it, upgrade to 2.1".

jaspernbrouwer commented 9 years ago

Sorry it takes a while before I can investigate this issue. So much to do, so little time :) But I haven't forgot you guys!

jaspernbrouwer commented 9 years ago

I've upgrade Powerline on my system to 2.1, and "it works on my machine" :) But like I said, I'm using ZSH with libzpython, so not using the daemon.

I've set up a virtual box with Bash, and can confirm the issue: When using the daemon, the segment doesn't show. Killing the daemon and the segment immediately appears. Starting it again and the segment is also gone again.

I've enabled a log-file and set the log level to DEBUG, but nothing is showing that can give me a hint. I guess I have to ask the folks of Powerline for some help!

jaspernbrouwer commented 9 years ago

I'm glad to report that this issue has been fixed in v1.0.3!

Bensge commented 9 years ago

Thanks, that's great news. I just tested it on my Mac and can confirm that it works flawlessly here as well. I can finally enjoy this plugin and have a performant shell prompt! Thanks for the effort and time you put into fixing this issue once again

23maverick23 commented 9 years ago

Thanks for the fix @jaspernbrouwer !

I can confirm that v1.0.3 addresses the issue with the missing segment and powerline-daemon. In case this helps anyone else, the problem wasn't initially fixed just by upgrading packages. I had to manually kill the daemon and restart it before your updates were applied.

$ powerline-daemon -k
# Kill command sent to daemon, if it does not die in a couple of seconds use kill to kill it

$ powerline-daemon -q

Info on the daemon process can be found here for reference.

zchee commented 9 years ago

@jaspernbrouwer Not working when launch powerline-daemon...

I want you to write explicitly what is necessary. python2? python3? and, libzpython?

jaspernbrouwer commented 9 years ago

The segment is tested with:

If you're having trouble, could you:

Thank you!

jaspernbrouwer commented 9 years ago

@Bensge, @23maverick23: Sorry guys! I've messed up a bit with these working directory issues (#1 and #4) :(

There's a new release (v1.1.0) that should fix them once and for all!