Displaying 7 results from an estimated 7 matches for "external_command_cod".
Did you mean:
external_command_code
2019 Jan 16
0
[PATCH 2/5] mltools: create a new external_command_code
Split most of the code from external_command to a new
external_command_code, so it is possible to get the exit code of the
process without considering it fatal.
---
common/mltools/tools_utils.ml | 22 ++++++++++------------
common/mltools/tools_utils.mli | 8 ++++++++
2 files changed, 18 insertions(+), 12 deletions(-)
diff --git a/common/mltools/tools_utils.ml b/commo...
2019 Jan 16
2
Re: [PATCH 2/5] mltools: create a new external_command_code
On Wed, Jan 16, 2019 at 03:17:32PM +0100, Pino Toscano wrote:
> Split most of the code from external_command to a new
> external_command_code, so it is possible to get the exit code of the
> process without considering it fatal.
> ---
> common/mltools/tools_utils.ml | 22 ++++++++++------------
> common/mltools/tools_utils.mli | 8 ++++++++
> 2 files changed, 18 insertions(+), 12 deletions(-)
>
> diff --git a/co...
2019 Jan 16
1
Re: [PATCH 3/5] mltools: add simple tests for external_command
...t test_run_commands ctx =
> end;
> ()
>
> +let test_external_command ctx =
> + assert_equal_stringlist [] (external_command "true");
> + assert_equal_stringlist ["out"] (external_command "echo out");
> + begin
> + let lines, code = external_command_code "true" in
> + assert_equal_int 0 code;
> + assert_equal_stringlist [] lines
> + end;
> + begin
> + let lines, code = external_command_code "false" in
> + assert_equal_int 1 code;
> + assert_equal_stringlist [] lines
> + end;
> + beg...
2019 Jan 16
10
[PATCH 0/5] [RFC] builder: handle unavailable repos
...lures, and handle the failures gracefully in virt-builder.
RFC because I'm not yet too convinced the approach I used (especially
for the changes in the Curl module) is optimal, so looking for feedback
on this.
Pino Toscano (5):
mltools: split helper do_check_exitcode
mltools: create a new external_command_code
mltools: add simple tests for external_command
mltools: curl: turn Curl.run to raise exceptions
builder: ignore repositories with download failures
builder/builder.ml | 39 ++++++++++++++++++++---------
common/mltools/curl.ml | 15 ++++++++++-
common/mltools/c...
2019 Jan 17
0
Re: [PATCH 2/5] mltools: create a new external_command_code
On Wednesday, 16 January 2019 15:31:43 CET Richard W.M. Jones wrote:
> BTW we use debug + Sys.command all over the place and it might be
> worth considering replacing those instances with this new function
> where appropriate.
Like Tools_utils.shell_command?
--
Pino Toscano
2019 Jan 16
0
[PATCH 3/5] mltools: add simple tests for external_command
...rse_resize ctx =
@@ -156,6 +157,26 @@ let test_run_commands ctx =
end;
()
+let test_external_command ctx =
+ assert_equal_stringlist [] (external_command "true");
+ assert_equal_stringlist ["out"] (external_command "echo out");
+ begin
+ let lines, code = external_command_code "true" in
+ assert_equal_int 0 code;
+ assert_equal_stringlist [] lines
+ end;
+ begin
+ let lines, code = external_command_code "false" in
+ assert_equal_int 1 code;
+ assert_equal_stringlist [] lines
+ end;
+ begin
+ let lines, code = external_command_co...
2019 Jan 16
0
[PATCH 4/5] mltools: curl: turn Curl.run to raise exceptions
...@ args in
{ curl = curl; args = args; tmpdir = tmpdir }
@@ -71,8 +73,19 @@ let run { curl; args; tmpdir } =
close_out chan;
let cmd = sprintf "%s -q --config %s" (quote curl) (quote config_file) in
- let lines = external_command ~echo_cmd:false cmd in
+ let lines, exitcode = external_command_code ~echo_cmd:false cmd in
Unix.unlink config_file;
+ if exitcode <> 0 then (
+ let url =
+ try
+ List.find_map (
+ function
+ | "url", Some url -> Some url
+ | _, _ -> None
+ ) args
+ with Not_found -> s_"(unknown...