Sanitize run_command argument output

Fixes #6316