Module Name:    src
Committed By:   sjg
Date:           Tue Dec 26 17:12:33 UTC 2023

Modified Files:
        src/usr.bin/make: compat.c
        src/usr.bin/make/unit-tests: depsrc-ignore.exp
            deptgt-delete_on_error.exp sh-leading-hyphen.exp

Log Message:
make: fix order of output in compat mode

Ensure that make's output is correctly ordered with the output of the
target's commands, even when the output does not go to a terminal.

Reviewed by: rillig


To generate a diff of this commit:
cvs rdiff -u -r1.249 -r1.250 src/usr.bin/make/compat.c
cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/depsrc-ignore.exp \
    src/usr.bin/make/unit-tests/sh-leading-hyphen.exp
cvs rdiff -u -r1.3 -r1.4 \
    src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/compat.c
diff -u src/usr.bin/make/compat.c:1.249 src/usr.bin/make/compat.c:1.250
--- src/usr.bin/make/compat.c:1.249	Sun Dec 24 16:48:30 2023
+++ src/usr.bin/make/compat.c	Tue Dec 26 17:12:33 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat.c,v 1.249 2023/12/24 16:48:30 sjg Exp $	*/
+/*	$NetBSD: compat.c,v 1.250 2023/12/26 17:12:33 sjg Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -91,7 +91,7 @@
 #include "pathnames.h"
 
 /*	"@(#)compat.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: compat.c,v 1.249 2023/12/24 16:48:30 sjg Exp $");
+MAKE_RCSID("$NetBSD: compat.c,v 1.250 2023/12/26 17:12:33 sjg Exp $");
 
 static GNode *curTarg = NULL;
 static pid_t compatChild;
@@ -400,6 +400,7 @@ Compat_RunCommand(const char *cmdp, GNod
 				 * but let others continue.
 				 */
 				printf(" (continuing)\n");
+				fflush(stdout);
 			} else {
 				printf("\n");
 			}
@@ -411,6 +412,7 @@ Compat_RunCommand(const char *cmdp, GNod
 			 * If we return 0, this will happen...
 			 */
 			printf(" (ignored)\n");
+			fflush(stdout);
 			status = 0;
 		}
 	}

Index: src/usr.bin/make/unit-tests/depsrc-ignore.exp
diff -u src/usr.bin/make/unit-tests/depsrc-ignore.exp:1.2 src/usr.bin/make/unit-tests/depsrc-ignore.exp:1.3
--- src/usr.bin/make/unit-tests/depsrc-ignore.exp:1.2	Sat Aug 29 15:06:33 2020
+++ src/usr.bin/make/unit-tests/depsrc-ignore.exp	Tue Dec 26 17:12:33 2023
@@ -1,8 +1,8 @@
 ignore-errors begin
 false ignore-errors
+*** Error code 1 (ignored)
 ignore-errors end
 all begin
-*** Error code 1 (ignored)
 false all
 *** Error code 1 (continuing)
 
Index: src/usr.bin/make/unit-tests/sh-leading-hyphen.exp
diff -u src/usr.bin/make/unit-tests/sh-leading-hyphen.exp:1.2 src/usr.bin/make/unit-tests/sh-leading-hyphen.exp:1.3
--- src/usr.bin/make/unit-tests/sh-leading-hyphen.exp:1.2	Thu Jan 19 19:55:27 2023
+++ src/usr.bin/make/unit-tests/sh-leading-hyphen.exp	Tue Dec 26 17:12:33 2023
@@ -6,6 +6,6 @@ unknown-command: not found
 *** Error code 127 (ignored)
 unknown-long-option 'needed for needshell in compat.c'
 unknown-long-option: not found
-whitespace in leading part
 *** Error code 127 (ignored)
+whitespace in leading part
 exit status 0

Index: src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp
diff -u src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.3 src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.4
--- src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp:1.3	Sat Mar 18 22:20:12 2023
+++ src/usr.bin/make/unit-tests/deptgt-delete_on_error.exp	Tue Dec 26 17:12:33 2023
@@ -16,6 +16,7 @@ make: *** deptgt-delete_on_error-regular
 
 Stop.
 make: stopped in unit-tests
+*** Error code 1 (ignored)
 
 Parallel mode
 > deptgt-delete_on_error-regular; false
@@ -45,5 +46,4 @@ make: stopped in unit-tests
 
 make: stopped in unit-tests
 *** Error code 1 (ignored)
-*** Error code 1 (ignored)
 exit status 0

Reply via email to