Thread (581 messages) flat view 581 messages, 16 authors, 2021-10-12
STALE1801d

Revision v2 of 2 in this series.

Revisions (2)
  1. v1 [diff vs current]
  2. v2 current

[PATCH v2 25/30] hooks: allow callers to capture output

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2021-06-14 10:39:11
Subsystem: the rest · Maintainer: Linus Torvalds

From: Emily Shaffer <redacted>

Some server-side hooks will require capturing output to send over
sideband instead of printing directly to stderr. Expose that capability.

Signed-off-by: Emily Shaffer <redacted>
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 hook.c | 2 +-
 hook.h | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/hook.c b/hook.c
index 0faa24ec825..17ae65eca31 100644
--- a/hook.c
+++ b/hook.c
@@ -166,7 +166,7 @@ int run_found_hooks(const char *hook_name, const char *hook_path,
 				   pick_next_hook,
 				   notify_start_failure,
 				   options->feed_pipe,
-				   NULL,
+				   options->consume_sideband,
 				   notify_hook_finished,
 				   &cb_data,
 				   "hook",
diff --git a/hook.h b/hook.h
index ff1697d1087..5f895032341 100644
--- a/hook.h
+++ b/hook.h
@@ -49,6 +49,14 @@ struct run_hooks_opt
 	 */
 	feed_pipe_fn feed_pipe;
 	void *feed_pipe_ctx;
+
+	/*
+	 * Populate this to capture output and prevent it from being printed to
+	 * stderr. This will be passed directly through to
+	 * run_command:run_parallel_processes(). See t/helper/test-run-command.c
+	 * for an example.
+	 */
+	consume_sideband_fn consume_sideband;
 };
 
 #define RUN_HOOKS_OPT_INIT { \
-- 
2.32.0.rc3.434.gd8aed1f08a7
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help