From 95ed7c6f0513debdc0c692e78b898c08b84eab99 Mon Sep 17 00:00:00 2001 From: Zane Bitter Date: Tue, 20 Dec 2016 17:29:14 -0500 Subject: [PATCH] Don't buffer log output in sed Services that run inside Apache use tail -f on the corresponding log file to display output in the screen session. However, they also use sed to replace some control characters, and this means that the output is buffered. This results in debugging experiences that range from "impossible" (the log you want isn't shown) to "Kafkaesque nightmare" (the log you want isn't shown, except that sometimes it is, and sometimes it isn't even though you double-checked and you're completely sure that you must have output a log, but when you check back later you realise it actually is and you wonder if history is actually not mutable after all and begin to question what is real and what is not). This adds the --unbuffered option to ensure streaming output. Change-Id: I665ff5f047156401d8152f478d834ac40ff31658 --- functions-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions-common b/functions-common index cc1d42b0d6..9423f9ed90 100644 --- a/functions-common +++ b/functions-common @@ -1678,7 +1678,7 @@ function tail_log { local logfile=$2 if [[ "$USE_SCREEN" = "True" ]]; then - screen_process "$name" "sudo tail -f $logfile | sed 's/\\\\\\\\x1b/\o033/g'" + screen_process "$name" "sudo tail -f $logfile | sed -u 's/\\\\\\\\x1b/\o033/g'" fi }