Fuego wiki

Login or create account

function safe cmd

NAME [edit section]


SYNOPSIS [edit section]

safe_cmd "<command>"

DESCRIPTION [edit section]

This function is used to execute a command on the target with a greater degree of safety. In particular, the oom score for the process is adjusted so that if the target platform runs out of memory during the execution, it will be the first process killed on the system.

It basically just calls ov_rootfs_oom to adjust the oom score, and then calls cmd with the command to execute on target.

This is chiefly used by report and report_append to avoid problems overflowing memory or disturbing other processes when executing the main command to execute the test.

EXAMPLES [edit section]

Here are some sample invocations:
        safe_cmd "{ $1; echo \$? > $RETCODE; } 2>&1 | tee $2; exit \$(cat $RETCODE; rm $RETCODE &>/dev/null)"

ENVIRONMENT and ARGUMENTS [edit section]

This function takes one positional argument, which is the command to execute.

RETURN [edit section]

Returns non-zero on error.

SOURCE [edit section]

Located in scripts/

SEE ALSO [edit section]

TBWiki engine 1.8.2 by Tim Bird