chris-marsh / pureline

A Pure Bash Powerline PS1 Command Prompt
MIT License
501 stars 94 forks source link

Background jobs count wrong #49

Closed LiteracyFanatic closed 3 years ago

LiteracyFanatic commented 3 years ago

pureline is now always showing a single job running in the background. I've traced the issue to the fact that I have PROMPT_COMMAND="cat $XDG_CACHE_HOME/wal/sequences" in my bashrc. The issue isn't specific to that file; cat itself seems to be the problem.

chris-marsh commented 3 years ago

Yes, I'm seeing the same. Using PROMPT_COMMAND="cat ~/.bashrc; jobs" gives; [1] Done cat ~/.bashrc So it appears the cat command is still in the background.

The change is due to pureline being moved to the end of the command prompt. It now does; PROMPT_COMMAND="pureline_pre; ${PROMPT_COMMAND} pureline_ps1;" and previously; [[ ! ${PROMPT_COMMAND} =~ 'pureline_ps1;' ]] && PROMPT_COMMAND="pureline_ps1; $PROMPT_COMMAND" Should jobs with a status of 'Done' be counted by pureline?

LiteracyFanatic commented 3 years ago

For now I've just moved prompt modification below where I source pureline. I think it might be better to ignore finished jobs though. I never realized why it was necessary until now, but I've gotten into the habit of hitting enter twice after killing a job to make the prompt update. It'd be nice if it updated immediately.

chris-marsh commented 3 years ago

Pushed a fix to hopefully resolve the issue? https://github.com/chris-marsh/pureline/commit/1d3d4eef7f4187be17600213726ea7756c7aa485

LiteracyFanatic commented 3 years ago

Yup, that's better. Thanks!