user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download mbox.gz: |
* [PATCH 2/7] daemon: simplify fork() failure checks
  2020-12-15 11:47  5% [PATCH/RFC 0/7] lei - Local Email Interface skeleton Eric Wong
@ 2020-12-15 11:47  7% ` Eric Wong
  0 siblings, 0 replies; 2+ results
From: Eric Wong @ 2020-12-15 11:47 UTC (permalink / raw)
  To: meta

The defined-or `//' operator in 5.10 allows us to golf down
our code slightly.
---
 lib/PublicInbox/Daemon.pm | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/lib/PublicInbox/Daemon.pm b/lib/PublicInbox/Daemon.pm
index fdedaee7..a2171535 100644
--- a/lib/PublicInbox/Daemon.pm
+++ b/lib/PublicInbox/Daemon.pm
@@ -237,8 +237,7 @@ EOF
 	};
 
 	if ($daemonize) {
-		my $pid = fork;
-		die "could not fork: $!\n" unless defined $pid;
+		my $pid = fork // die "fork: $!";
 		exit if $pid;
 
 		open(STDIN, '+<', '/dev/null') or
@@ -246,8 +245,7 @@ EOF
 		open STDOUT, '>&STDIN' or die "redirect stdout failed: $!\n";
 		open STDERR, '>&STDIN' or die "redirect stderr failed: $!\n";
 		POSIX::setsid();
-		$pid = fork;
-		die "could not fork: $!\n" unless defined $pid;
+		$pid = fork // die "fork: $!";
 		exit if $pid;
 	}
 	return unless defined $pid_file;

^ permalink raw reply related	[relevance 7%]

* [PATCH/RFC 0/7] lei - Local Email Interface skeleton
@ 2020-12-15 11:47  5% Eric Wong
  2020-12-15 11:47  7% ` [PATCH 2/7] daemon: simplify fork() failure checks Eric Wong
  0 siblings, 1 reply; 2+ results
From: Eric Wong @ 2020-12-15 11:47 UTC (permalink / raw)
  To: meta

patches 1 and 2 are boring cleanups.

The most important is 4/7 which features data structures
for a proposed command set.  Hopefully the command-names
and 1-line descriptions are helpful.

Comments from (potential) users appreciated, especially about 4/7.


I decided to take care of patch 3/7 (FD-passing) early on
because startup latency sucks.

I never used notmuch, but this will feature saved searches (aka
"named queries").  Otherwise, the query subcommand will probably
operate like mairix and dump the results to a
Maildir/mbox/etc...

patch 5/7 - keywords (e.g. `seen', 'draft', ...) read/write
(but not query) support added.

And a couple more cleanups.

lei will have its own writable git storage on top of extindex,
but will be able to do read-only queries against extinbox
(publicinbox || extindex) sources.

Eric Wong (7):
  daemon: support --daemonize without Net::Server::Daemonize
  daemon: simplify fork() failure checks
  lei: FD-passing and IPC basics
  lei: proposed command-listing and options
  lei_store: local storage for Local Email Interface
  tests: more common JSON module loading
  lei: use spawn (vfork + execve) for lazy start

 MANIFEST                          |   6 +
 lib/PublicInbox/Daemon.pm         |  26 +-
 lib/PublicInbox/ExtSearch.pm      |   4 +-
 lib/PublicInbox/ExtSearchIdx.pm   |  35 ++-
 lib/PublicInbox/Import.pm         |   4 +
 lib/PublicInbox/LeiDaemon.pm      | 449 ++++++++++++++++++++++++++++++
 lib/PublicInbox/LeiSearch.pm      |  40 +++
 lib/PublicInbox/LeiStore.pm       | 197 +++++++++++++
 lib/PublicInbox/ManifestJsGz.pm   |   2 +-
 lib/PublicInbox/OverIdx.pm        |  10 +
 lib/PublicInbox/SearchIdx.pm      |  47 +++-
 lib/PublicInbox/SearchIdxShard.pm |  33 +++
 lib/PublicInbox/TestCommon.pm     |   4 +
 lib/PublicInbox/V2Writable.pm     |   2 +-
 script/lei                        |  64 +++++
 t/extsearch.t                     |   3 +-
 t/lei.t                           |  79 ++++++
 t/lei_store.t                     |  74 +++++
 t/www_listing.t                   |   8 +-
 19 files changed, 1055 insertions(+), 32 deletions(-)
 create mode 100644 lib/PublicInbox/LeiDaemon.pm
 create mode 100644 lib/PublicInbox/LeiSearch.pm
 create mode 100644 lib/PublicInbox/LeiStore.pm
 create mode 100755 script/lei
 create mode 100644 t/lei.t
 create mode 100644 t/lei_store.t


^ permalink raw reply	[relevance 5%]

Results 1-2 of 2 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2020-12-15 11:47  5% [PATCH/RFC 0/7] lei - Local Email Interface skeleton Eric Wong
2020-12-15 11:47  7% ` [PATCH 2/7] daemon: simplify fork() failure checks Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).