Procwait 1.3 Released
2017-02-15Procwait 1.3 is now tagged and pushed to to github and git.harski.org. The tarball can be downloaded from here. For Gentoo users, an ebuild has been added to pakki.
The main thing the release introduces is the ability to match for
program names directly with -n PNAME (--name PNAME) argument option. The
name PNAME is checked against is the executable name in /proc/PID/stat.
Previously it was possible to achieve something similar by executing
procwait $(pidof program_name)
, but pidof doesn't always behave as
you would expect it to when running programs written in interpreted
languages (python, perl etc.)
Let's take a real life example: sometimes when updating my Gentoo system
in the middle of the process I notice I can't stay and wait for the
update process to end. I have to leave, but would still like to shutdown
the computer once the update process is finished. I started the update
process with a command emerge -Du @world
, so with the help of pidof
I would achieve that with procwait $(pidof emerge)
, right? Wrong. As
portage is written in python, the program name that pidof matches for
(and is show in ps and top outputs) is actually /usr/bin/python3.4,
and trying to match for emerge processes results in empty set.
From version 1.3 on procwait -n emerge
will behave as you would expect
it to and find the emerge process.