summaryrefslogtreecommitdiffstats
path: root/src/client.c
diff options
context:
space:
mode:
authorOpenGnSys Support Team <soporte-og@soleta.eu>2024-06-21 14:10:13 +0200
committerOpenGnSys Support Team <soporte-og@soleta.eu>2024-06-21 14:12:02 +0200
commit12d5caf6a6af5cb4870d375e185341909fc61b7e (patch)
tree11809851babe6041b5705447e9e53f876bcaf7a7 /src/client.c
parent98fab52b74ea9cbf7bdac7a022504fc6be90be88 (diff)
rest: add retcode to shell/output
Add retcode field to specify return code of shell invocation.
Diffstat (limited to 'src/client.c')
-rw-r--r--src/client.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/client.c b/src/client.c
index 9989462..46baab8 100644
--- a/src/client.c
+++ b/src/client.c
@@ -172,6 +172,7 @@ static int og_resp_probe(struct og_client *cli, json_t *data)
static int og_resp_shell_run(struct og_client *cli, json_t *data)
{
const char *output = NULL;
+ uint32_t retcode;
const char *key;
json_t *value;
int err = -1;
@@ -184,7 +185,12 @@ static int og_resp_shell_run(struct og_client *cli, json_t *data)
err = og_json_parse_string(value, &output);
if (err < 0)
return err;
+ } else if (!strcmp(key, "retcode")) {
+ err = og_json_parse_uint(value, &retcode);
+ if (err < 0)
+ return err;
}
+
}
if (!output) {
@@ -193,8 +199,9 @@ static int og_resp_shell_run(struct og_client *cli, json_t *data)
return -1;
}
- free((void *)cli->shell_output);
- cli->shell_output = strdup(output);
+ free((void *)cli->shell.output);
+ cli->shell.output = strdup(output);
+ cli->shell.retcode = retcode;
return 0;
}