Commit 6f413a51 authored by Kirill Tkhai's avatar Kirill Tkhai Committed by Pavel Emelyanov

scripts: Print error value in case of action script fail

For easier debugging.

v2: Forward scripts messages to criu log using cr_system

travis-ci: success for scripts: Print error value in case of action script fail (rev2)
Signed-off-by: 's avatarKirill Tkhai <ktkhai@virtuozzo.com>
Acked-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent 7cb248ee
......@@ -12,6 +12,7 @@
#include "action-scripts.h"
#include "pstree.h"
#include "common/bug.h"
#include "util.h"
static const char *action_names[ACT_MAX] = {
[ ACT_PRE_DUMP ] = "pre-dump",
......@@ -42,7 +43,7 @@ static LIST_HEAD(scripts);
static int run_shell_scripts(const char *action)
{
int ret = 0;
int retval = 0;
struct script *script;
char image_dir[PATH_MAX];
static unsigned env_set = 0;
......@@ -80,13 +81,18 @@ static int run_shell_scripts(const char *action)
}
list_for_each_entry(script, &scripts, node) {
int err;
pr_debug("\t[%s]\n", script->path);
ret |= system(script->path);
err = cr_system(-1, -1, -1, script->path,
(char *[]) { script->path, NULL }, 0);
if (err)
pr_err("Script %s exited with %d\n", script->path, err);
retval |= err;
}
unsetenv("CRTOOLS_SCRIPT_ACTION");
return ret;
return retval;
}
int run_scripts(enum script_actions act)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment