summaryrefslogtreecommitdiffstats
path: root/exec.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2022-03-13 14:43:14 -0400
committerTavian Barnes <tavianator@tavianator.com>2022-03-13 14:43:14 -0400
commit21344dfb72f9b65b366ca5f754f1bc35f52da3c7 (patch)
treee5c4c4011bfdbe2b745336768c61ddc4652fbef8 /exec.c
parentc4676b38309bba5d24efeb22f52fbeaace7dcbe2 (diff)
downloadbfs-21344dfb72f9b65b366ca5f754f1bc35f52da3c7.tar.xz
exec: Don't flush if the user says no to -ok
Diffstat (limited to 'exec.c')
-rw-r--r--exec.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/exec.c b/exec.c
index 85c472c..269ad07 100644
--- a/exec.c
+++ b/exec.c
@@ -325,9 +325,6 @@ 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) {
fprintf(stderr, "%s ", execbuf->argv[i]);
@@ -340,6 +337,9 @@ 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);