summaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-03-13 14:35:43 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-03-13 14:39:57 -0400
commitc4676b38309bba5d24efeb22f52fbeaace7dcbe2 (patch)
tree2c61b43e916e53f3a015ff31081252b6bd6c730e /exec.c
parentb277c47ea4154e5d5acc0927d8f8374f489b4437 (diff)
downloadbfs-c4676b38309bba5d24efeb22f52fbeaace7dcbe2.tar.xz
ctx: Factor out exec flushing behaviour into bfs_ctx_flush()
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/exec.c b/exec.c
index 505e51c..85c472c 100644
--- a/exec.c
+++ b/exec.c
@@ -325,14 +325,8 @@ static void bfs_exec_closewd(struct bfs_exec *execbuf, const struct BFTW *ftwbuf
/** Actually spawn the process. */
static int bfs_exec_spawn(const struct bfs_exec *execbuf) {
- // Before executing anything, flush all open streams. This ensures that
- // - the user sees everything relevant before an -ok[dir] prompt
- // - output from commands is interleaved consistently with bfs
- // - executed commands can rely on I/O from other bfs actions
- //
- // We do not check errors here, but they will be caught at cleanup time
- // with ferror().
- fflush(NULL);
+ // Flush the context state for consistency with the external process
+ bfs_ctx_flush(execbuf->ctx);
if (execbuf->flags & BFS_EXEC_CONFIRM) {
for (size_t i = 0; i < execbuf->argc; ++i) {