[PATCH setup 0/2] List and offer to kill processes preventing a file from being written
Jon TURNEY
jon.turney@dronecode.org.uk
Tue Feb 5 15:26:00 GMT 2013
I find it irritating to have to work out which process I need to stop when setup
can't update a file, and setup not helping you find it doesn't really meet
contemporary standards. So, loosely inspired by [1], a patch to list and offer
to kill processes preventing a file from being written.
This uses psapi.dll to find which out processes have a file loaded as a module.
Note that this doesn't help when file isn't writeable because process has the
file open exclusively, but there doesn't seem to be an interface to do this
until the restart manager API introduced in Vista.
This relies on the probably undocumented behaviour of /usr/bin/kill working with
windows PIDs as well as cygwin PIDs, and the assumption those PID sets are
disjoint.
Ideally, I wanted to note if the process which had the file loaded was a
service, and stop and restart the service. But this seems to be not
straightforward to do, as setup doesn't have any visibility of the cygwin
process tree, which is needed to find the cygrunsrv service process which is the
parent of the process using the file, and thus the service name to stop and
restart.
[1] http://cygwin.com/ml/cygwin/2012-08/msg00444.html
Jon TURNEY (2):
Refactor ::run() so it's more generally useful
List and offer to kill processes preventing a file from being written
Makefile.am | 4 +-
install.cc | 152 +++++++++++++++++++++++++-----------
processlist.cc | 237 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
processlist.h | 41 ++++++++++
res.rc | 20 +++++
resource.h | 4 +
script.cc | 33 +++++----
script.h | 7 +-
8 files changed, 435 insertions(+), 63 deletions(-)
create mode 100644 processlist.cc
create mode 100644 processlist.h
--
1.7.9
More information about the Cygwin-apps
mailing list