[PATCH] Fix cygrunsrv invocation in cygcheck

Brian Dessent brian@dessent.net
Tue Aug 16 23:02:00 GMT 2005

Igor Pechtchanski wrote:

> As mentioned in <http://cygwin.com/ml/cygwin/2005-08/msg00724.html>, I
> noticed something strange in the "cygcheck -s" output:

This fix was part of my patch from June in
<http://cygwin.com/ml/cygwin-patches/2005-q2/msg00138.html> but since it
was grouped with the unrelated cygcheck -p code, it kind of got lost on
the floor.

> why not simply run "cygrunsrv --list --verbose" in verbose mode, instead
> of actually going through one iteration of the loop?  Simply to reuse the
> "copy output" code?  Brian?

The reason I did it that way is because if I had run "cygrunsrv --list
--verbose" initially, then it would be necessary to parse the output and
extract out the service names, since it has to run "cygrunsrv --query"
for each individual service in the case of (!verbose).  By running just
"cygrunsrv --list" you get a simple listing of service names with no
parsing necessary, and I did not want to make cygcheck depend on the
particular output format of cygrunsrv.

This is awkward I admit because there is no cygrunsrv option that does
the equivalent of "--query" for all services.  So to support both
verbose and non-verbose listing of all services, you either have to run
"--list --verbose" and then filter out the fields that should not be in
the verbose output, or you have to run "--query" individually for each
service.  And I did not want to mess about with text parsing and
filtering so I decided to take the easy route and just invoke cygrunsrv
a few extra times.


More information about the Cygwin-patches mailing list