summaryrefslogtreecommitdiffstats
path: root/src/exec.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-11-10 11:02:19 -0500
committerTavian Barnes <tavianator@tavianator.com>2022-11-10 11:53:02 -0500
commitf98a1c4a1cf61ff7d6483388ca1fac365fb0b31b (patch)
treef7e9dc817dfb44a4fd9d7588fbb74c343720f613 /src/exec.c
parent8aea34df2d84dc6c343ec0e349973dfa62307116 (diff)
downloadbfs-f98a1c4a1cf61ff7d6483388ca1fac365fb0b31b.tar.xz
Revert "exec: Don't flush if the user says no to -ok"
From the bfs_ctx_flush() implementation: // Before executing anything, flush all open streams. This ensures that // - the user sees everything relevant before an -ok[dir] prompt But that only works if we call it before the prompt. This reverts commit 21344dfb72f9b65b366ca5f754f1bc35f52da3c7.
Diffstat (limited to 'src/exec.c')
-rw-r--r--src/exec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/exec.c b/src/exec.c
index b88a8b8..759582e 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -352,6 +352,9 @@ 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) {
+ // 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) {
if (fprintf(stderr, "%s ", execbuf->argv[i]) < 0) {
@@ -368,9 +371,6 @@ static int bfs_exec_spawn(const struct bfs_exec *execbuf) {
}
}
- // Flush cached state for consistency with the external process
- bfs_ctx_flush(execbuf->ctx);
-
if (execbuf->flags & BFS_EXEC_MULTI) {
bfs_exec_debug(execbuf, "Executing '%s' ... [%zu arguments] (size %zu)\n",
execbuf->argv[0], execbuf->argc - 1, execbuf->arg_size);