From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 5/5] index-helper: add --detach
Date: Tue, 10 Jun 2014 20:24:25 +0700 [thread overview]
Message-ID: <1402406665-27988-6-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1402406665-27988-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
Documentation/git-index-helper.txt | 4 +++-
index-helper.c | 6 +++++-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/Documentation/git-index-helper.txt b/Documentation/git-index-helper.txt
index afeb334..303cda0 100644
--- a/Documentation/git-index-helper.txt
+++ b/Documentation/git-index-helper.txt
@@ -8,7 +8,7 @@ git-index-helper - A simple cache server for speeding up index file access
SYNOPSIS
--------
[verse]
-'git index-helper
+'git index-helper [--detach]
DESCRIPTION
-----------
@@ -18,6 +18,8 @@ shared memory support (e.g. Linux or Windows)
OPTIONS
-------
+--detach::
+ Detach from the shell.
GIT
---
diff --git a/index-helper.c b/index-helper.c
index f92326a..9420591 100644
--- a/index-helper.c
+++ b/index-helper.c
@@ -159,8 +159,9 @@ int main(int argc, char **argv)
static struct lock_file lock;
struct strbuf sb = STRBUF_INIT;
const char *prefix;
- int fd;
+ int fd, detach = 0;
struct option options[] = {
+ OPT_BOOL(0, "detach", &detach, "detach the process"),
OPT_END()
};
@@ -188,6 +189,9 @@ int main(int argc, char **argv)
sigchain_push(SIGQUIT, cleanup_on_signal);
sigchain_push(SIGPIPE, cleanup_on_signal);
+ if (detach && daemonize(&daemonized))
+ die_errno("unable to detach");
+
loop(sb.buf, 600);
strbuf_release(&sb);
return 0;
--
1.9.1.346.ga2b5940
prev parent reply other threads:[~2014-06-10 13:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-10 13:24 [PATCH v2 0/5] Speed up cache loading time Nguyễn Thái Ngọc Duy
2014-06-10 13:24 ` [PATCH 1/5] read-cache: allow to keep mmap'd memory after reading Nguyễn Thái Ngọc Duy
2014-06-10 13:24 ` [PATCH 2/5] index-helper: new daemon for caching index and related stuff Nguyễn Thái Ngọc Duy
2014-06-10 18:44 ` David Turner
2014-06-10 13:24 ` [PATCH 3/5] index-helper: add Windows support Nguyễn Thái Ngọc Duy
2014-06-10 13:24 ` [PATCH 4/5] daemonize(): set a flag before exiting the main process Nguyễn Thái Ngọc Duy
2014-06-10 13:24 ` Nguyễn Thái Ngọc Duy [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1402406665-27988-6-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.