Run command with timeout but always with exit code 0

I want to create a run command that executes a script, but if the runs script too long, CircleCI can kill it.
Despite the timeout, I want this script to always be regarded as successful, because the result of this script is not too important.

So when I get: Too long with no output (exceeded 10m0s)
I want the script to be regarded as having succeeded. How can I configure this?

You can put | true at the end of your command.

I found a custom solution using timeout.

Lovely. What was the solution?

timeout=$(command -v timeout)
if [ -z $timeout ]; then
    timeout=$(command -v gtimeout)
fi

if [ -z $timeout ]; then
    echo "WARNING: timeout program not found, running without it\n"
else
    timeout_cmd="$timeout 80"
fi

$timeout_cmd <insert command here>
1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.