فهرست منبع

fix: repair console timestamp logging (#5073)

Daniel Gibbs 1 روز پیش
والد
کامیت
6872f095b9
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 3 0
      lgsm/modules/check_deps.sh
  2. 3 2
      lgsm/modules/command_start.sh

+ 3 - 0
lgsm/modules/check_deps.sh

@@ -511,6 +511,9 @@ if [ -f "${datadir}/${distroid}-${distroversioncsv}.csv" ]; then
 	array_deps_required=("${depall} ${depsteamcmd} ${depshortname}")
 	array_deps_required_steamcmd=("${depsteamcmd}")
 	fn_deps_email
+	if [ "${logtimestamp}" == "on" ]; then
+		array_deps_required+=(gawk)
+	fi
 	# Unique sort dependency array.
 	IFS=" " read -r -a array_deps_required <<< "$(echo "${array_deps_required[@]}" | tr ' ' '\n' | sort -u | tr '\n' ' ')"
 

+ 3 - 2
lgsm/modules/command_start.sh

@@ -8,7 +8,8 @@
 commandname="START"
 commandaction="Starting"
 moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
-addtimestamp="gawk '{ print strftime(\\\"[$logtimestampformat]\\\"), \\\$0 }'"
+logtimestampformat_tmux="${logtimestampformat//%/%%}"
+addtimestamp="gawk '{ print strftime(\"[$logtimestampformat_tmux]\"), \$0; fflush() }'"
 fn_firstcommand_set
 
 # This will allow the Jedi Knight 2 version to be printed in console on start.
@@ -157,7 +158,7 @@ fn_start_tmux() {
 	if [ "${consolelogging}" == "on" ] || [ -z "${consolelogging}" ]; then
 		# timestamp will break mcb update check.
 		if [ "${logtimestamp}" == "on" ] && [ "${shortname}" != "mcb" ]; then
-			TERM=screen tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec bash -c \"cat | $addtimestamp\" >> '${consolelog}'"
+			TERM=screen tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec ${addtimestamp} >> '${consolelog}'"
 		else
 			TERM=screen tmux -L "${socketname}" pipe-pane -o -t "${sessionname}" "exec cat >> '${consolelog}'"
 		fi