]> Sergey Matveev's repositories - public-inbox.git/commit
lei: support `daemon-env' for modifying long-lived env
authorEric Wong <e@80x24.org>
Wed, 16 Dec 2020 09:30:28 +0000 (09:30 +0000)
committerEric Wong <e@80x24.org>
Sat, 19 Dec 2020 09:32:08 +0000 (09:32 +0000)
commitbcf5e76a87b46b038509b65ced64149e6d2b81c3
treeafb6f36f8aa0e986908adbc60e2ba7a03ed50e87
parente605ec76c5a3afe9390ca95709fed719a098235a
lei: support `daemon-env' for modifying long-lived env

While lei(1) socket connections can set environment variables
for its running context, it may not completely remove some of
them.  The background daemon just inherits whatever env the
client spawning it had.  This command ensures the persistent env
can be modified as needed.

Similar to env(1), this supports "-u", "-" (--clear), and
"-0"/"-z" switches.  It may be useful to unset or change
or even completely clear the environment independently
of what a socket client feeds us.

"-i" is omitted since "--ignore-environment" seems like a bad
name for a persistent daemon as opposed to a one-shot command.
"-" and --clear (like clearenv(3)) will completely clobber
the environment.

"Lonesome dash" support is added to our option/help parsing
for the "-" shortcut to "--clear".
Getopt::Long doesn't seem to support specs like "clear|" or
"stdin|", but only "", so we do a little pre/post-processing
to merge the cases.
lib/PublicInbox/LeiDaemon.pm
t/lei.t