summaryrefslogblamecommitdiff
path: root/user/feh/stdout-buff.patch
blob: eaa251a3a7b6ac10659936f013b46a88126756c8 (plain) (tree)
















































































































                                                                                   
On glibc, if output is redirected to a file, output will look like this:

touch test/ok/gif
touch test/ok/jpg
touch test/ok/png
touch test/ok/pnm
test/ok/gif
test/ok/jpg
test/ok/png
test/ok/pnm

On musl, if stdout is redirected to a file, output looks like this:

test/ok/gif
touch test/ok/gif
touch test/ok/jpg
touch test/ok/png
touch test/ok/pnm
test/ok/jpg
test/ok/png
test/ok/pnm

On glibc and musl, if stdout is interactive, it looks like this:

test/ok/gif
touch test/ok/gif
test/ok/jpg
touch test/ok/jpg
test/ok/png
touch test/ok/png
test/ok/pnm
touch test/ok/pnm

Adding two fflush calls makes all behavior look like the last example.

--- feh-2.22/src/list.c	2017-11-04 14:03:43.000000000 +0000
+++ feh-2.22/src/list.c	2018-01-03 02:59:08.840000000 +0000
@@ -92,6 +92,7 @@
 				if (opt.verbose)
 					feh_display_status('.');
 				puts(file->filename);
+				fflush(stdout);
 				feh_action_run(file, opt.actions[0], NULL);
 			}
 			else {
@@ -106,6 +107,7 @@
 				if (opt.verbose)
 					feh_display_status('.');
 				puts(file->filename);
+				fflush(stdout);
 				feh_action_run(file, opt.actions[0], NULL);
 			}
 			else {
--- feh-2.22/test/nx_action/loadable_action	2017-11-04 14:03:43.000000000 +0000
+++ feh-2.22/test/nx_action/loadable_action	2018-01-03 02:46:48.030000000 +0000
@@ -1,8 +1,8 @@
-touch test/ok/gif
-touch test/ok/jpg
-touch test/ok/png
-touch test/ok/pnm
 test/ok/gif
+touch test/ok/gif
 test/ok/jpg
+touch test/ok/jpg
 test/ok/png
+touch test/ok/png
 test/ok/pnm
+touch test/ok/pnm
--- feh-2.22/test/nx_action/loadable_naction	2017-11-04 14:03:43.000000000 +0000
+++ feh-2.22/test/nx_action/loadable_naction	2018-01-03 02:51:05.340000000 +0000
@@ -1,8 +1,8 @@
-touch test/ok/gif
-touch test/ok/jpg
-touch test/ok/png
-touch test/ok/pnm
 test/ok/gif
+touch test/ok/gif
 test/ok/jpg
+touch test/ok/jpg
 test/ok/png
+touch test/ok/png
 test/ok/pnm
+touch test/ok/pnm
--- feh-2.22/test/nx_action/unloadable_action	2017-11-04 14:03:43.000000000 +0000
+++ feh-2.22/test/nx_action/unloadable_action	2018-01-03 02:51:36.480000000 +0000
@@ -1,8 +1,8 @@
-rm test/fail/gif
-rm test/fail/jpg
-rm test/fail/png
-rm test/fail/pnm
 test/fail/gif
+rm test/fail/gif
 test/fail/jpg
+rm test/fail/jpg
 test/fail/png
+rm test/fail/png
 test/fail/pnm
+rm test/fail/pnm
--- feh-2.22/test/nx_action/unloadable_naction	2017-11-04 14:03:43.000000000 +0000
+++ feh-2.22/test/nx_action/unloadable_naction	2018-01-03 02:51:51.850000000 +0000
@@ -1,8 +1,8 @@
-rm test/fail/gif
-rm test/fail/jpg
-rm test/fail/png
-rm test/fail/pnm
 test/fail/gif
+rm test/fail/gif
 test/fail/jpg
+rm test/fail/jpg
 test/fail/png
+rm test/fail/png
 test/fail/pnm
+rm test/fail/pnm