Bug: Set rights for client sw

split function elog_add_command_subshell and elog_add_command
This commit is contained in:
Daniel Pätzold
2026-03-16 12:07:29 +01:00
parent 264d1d4931
commit fe8c7f1724
3 changed files with 14 additions and 4 deletions
+11 -1
View File
@@ -41,8 +41,18 @@ elog_add() {
echo $@ | tee ${LOGFILE} -a
}
elog_add_command() {
#Run a command, capture all output (STD and ERR) to the logfile AND in variable RETTXT AND output to screen
#Run a command, capture output (STD and ERR) to the logfile AND in variable RETTXT AND output to screen
#Returns the exit value of the command in $? and in RETNO
RETTXT=$( $@ > >(tee -a ${LOGFILE}) 2>&1 )
RETNO=$?
echo "${RETTXT}"
return ${RETNO}
}
elog_add_command_subshell() {
# Special Version of above, where the command will be completely executed in a subshell. This is needed for some commands, that may output to
# something else than STD or ERR and otherwise cannot be captured completely.
# Benefit: Really catch everything that is send to output
# Disadvantage: Output wont't display directly, but only after finshed execution
RETTXT=$( { $@ > >(tee -a ${LOGFILE}); } 2> >(tee -a ${LOGFILE}) )
RETNO=$?
echo "${RETTXT}"