Commit Graph

3 Commits (b90ae065b5a5fab4ed475bf2faa3a84476389a02)

Author SHA1 Message Date
Ludovic Courtès c20d4cac1f
processes: Gracefully handle daemons without clients.
Fixes <https://bugs.gnu.org/34716>.
Reported by Mark H Weaver <mhw@netris.org>.

The problem could be reproduced by running, on one hand:

  sh -c 'exec -a guix-daemon sleep 777'

and on the other hand:

  guix processes

If there is no process with PID 777, 'guix processes' would barf as it
stumbles upon a <daemon-session> record whose client is #f.

* guix/scripts/processes.scm (daemon-sessions)[child-process->session]:
New procedure, with lambda formerly passed to 'map'.  Handle #f returns
from 'lookup-process'.
Call 'child-process->session' within 'filter-map', not just 'map'.
2019-04-29 21:54:10 +02:00
Ludovic Courtès c21d912a02
processes: 'process-open-files' ignores disappeared /proc/PID/fd entries.
Previously, 'process-open-files' would throw ENOENT if an entry had
vanished after the 'scandir' call and before the 'readlink' call.

* guix/scripts/processes.scm (process-open-files): Catch ENOENT errors
from 'readlink'.
2019-04-29 21:39:38 +02:00
Ludovic Courtès 63eb2b899b
Add 'guix processes'.
* guix/scripts/processes.scm, tests/processes.scm: New files.
* Makefile.am (MODULES): Add the former.
(SCM_TESTS): Add the latter.
* po/guix/POTFILES.in: Add guix/scripts/processes.scm.
* doc/guix.texi (Invoking guix processes): New node.
(Invoking guix-daemon): Reference it.
2018-10-29 00:13:38 +01:00