jorgebucaran / hydro

Ultra-pure, lag-free prompt with async Git status—just for Fish
MIT License
697 stars 53 forks source link

use $last_pid instead of jobs -lp #53

Closed giorgiga closed 7 months ago

giorgiga commented 8 months ago

jobs --last --pid gives the pid of the most recently started job that is still running (or nothing if none is running), while $last_pid will give what one expects regardless.

Try:

❱ command true & ; sleep .1 ; echo -e "last_pid: $last_pid\njobs -lp: $(jobs -lp)"
last_pid: 17238
jobs -lp: 

This PR does very little difference in practice (the only thing it fixes is that, in the unlikey case one has other running jobs and the even more unlikely case the whole background fish process ends before jobs --last --pid is called, hydro may end up terminating an unrelated job), so don't think too much about it if you feel it may introduce other issues.

jorgebucaran commented 7 months ago

I'm convinced! Let's give this a shot. 😄