7
7
#include "khash.h"
8
8
9
9
static const char * const builtin_fsmonitor__daemon_usage [] = {
10
- N_ ("git fsmonitor--daemon stop" ),
11
- N_ ("git fsmonitor--daemon status" ),
12
10
NULL
13
11
};
14
12
15
13
#ifdef HAVE_FSMONITOR_DAEMON_BACKEND
16
- /*
17
- * Acting as a CLIENT.
18
- *
19
- * Send a "quit" command to the `git-fsmonitor--daemon` (if running)
20
- * and wait for it to shutdown.
21
- */
22
- static int do_as_client__send_stop (void )
23
- {
24
- struct strbuf answer = STRBUF_INIT ;
25
- int ret ;
26
-
27
- ret = fsmonitor_ipc__send_command ("quit" , & answer );
28
-
29
- /* The quit command does not return any response data. */
30
- strbuf_release (& answer );
31
-
32
- if (ret )
33
- return ret ;
34
-
35
- trace2_region_enter ("fsm_client" , "polling-for-daemon-exit" , NULL );
36
- while (fsmonitor_ipc__get_state () == IPC_STATE__LISTENING )
37
- sleep_millisec (50 );
38
- trace2_region_leave ("fsm_client" , "polling-for-daemon-exit" , NULL );
39
-
40
- return 0 ;
41
- }
42
-
43
- static int do_as_client__status (void )
44
- {
45
- enum ipc_active_state state = fsmonitor_ipc__get_state ();
46
-
47
- switch (state ) {
48
- case IPC_STATE__LISTENING :
49
- printf (_ ("fsmonitor-daemon is watching '%s'\n" ),
50
- the_repository -> worktree );
51
- return 0 ;
52
-
53
- default :
54
- printf (_ ("fsmonitor-daemon is not watching '%s'\n" ),
55
- the_repository -> worktree );
56
- return 1 ;
57
- }
58
- }
59
14
60
15
int cmd_fsmonitor__daemon (int argc , const char * * argv , const char * prefix )
61
16
{
@@ -80,12 +35,6 @@ int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix)
80
35
argc = parse_options (argc , argv , prefix , options ,
81
36
builtin_fsmonitor__daemon_usage , 0 );
82
37
83
- if (!strcmp (subcmd , "stop" ))
84
- return !!do_as_client__send_stop ();
85
-
86
- if (!strcmp (subcmd , "status" ))
87
- return !!do_as_client__status ();
88
-
89
38
die (_ ("Unhandled subcommand '%s'" ), subcmd );
90
39
}
91
40
0 commit comments