search for: with_open_in

Displaying 8 results from an estimated 8 matches for "with_open_in".

2017 Nov 05
3
[PATCH 1/2] common/mlstdutils: Add with_open_in and with_open_out functions.
...f --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml index ba23f39ed..ee6bea5af 100644 --- a/common/mlstdutils/std_utils.ml +++ b/common/mlstdutils/std_utils.ml @@ -654,20 +654,29 @@ let verbose = ref false let set_verbose () = verbose := true let verbose () = !verbose +let with_open_in filename f = + let chan = open_in filename in + protect ~f:(fun () -> f chan) ~finally:(fun () -> close_in chan) + +let with_open_out filename f = + let chan = open_out filename in + protect ~f:(fun () -> f chan) ~finally:(fun () -> close_out chan) + let read_whole_file path = l...
2017 Nov 07
0
[PATCH] common/mlstdutils: Add with_openfile function.
...f:(fun () -> f chan) ~finally:(fun () -> close_out chan) +let with_openfile filename flags perms f = + let fd = Unix.openfile filename flags perms in + protect ~f:(fun () -> f fd) ~finally:(fun () -> Unix.close fd) + let read_whole_file path = let buf = Buffer.create 16384 in with_open_in path ( diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli index 7af6c2111..e30d8eec3 100644 --- a/common/mlstdutils/std_utils.mli +++ b/common/mlstdutils/std_utils.mli @@ -399,6 +399,12 @@ val with_open_out : string -> (out_channel -> 'a) -> 'a retu...
2017 Nov 05
0
[PATCH 2/2] common/mlstdutils: Add with_openfile function.
...otect ~f:(fun () -> f chan) ~finally:(fun () -> close_out chan) +let with_openfile filename flags perms = + let fd = Unix.openfile filename flags perms in + protect ~f:(fun () -> f fd) ~finally:(fun () -> close fd) + let read_whole_file path = let buf = Buffer.create 16384 in with_open_in path ( diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli index 7af6c2111..178762819 100644 --- a/common/mlstdutils/std_utils.mli +++ b/common/mlstdutils/std_utils.mli @@ -399,6 +399,12 @@ val with_open_out : string -> (out_channel -> 'a) -> 'a retu...
2018 Aug 20
2
[PATCH 1/2] mlstdutils/mltools: factorize the machine-readable option
...utils.ml +++ b/common/mlstdutils/std_utils.ml @@ -645,6 +645,10 @@ let verbose = ref false let set_verbose () = verbose := true let verbose () = !verbose +let machine_readable = ref false +let set_machine_readable () = machine_readable := true +let machine_readable () = !machine_readable + let with_open_in filename f = let chan = open_in filename in protect ~f:(fun () -> f chan) ~finally:(fun () -> close_in chan) diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli index c887249a5..cb72fef7d 100644 --- a/common/mlstdutils/std_utils.mli +++ b/common/mlstdutils/std...
2019 Aug 13
5
[PATCH 0/3] generator: pod2text-related improvements
- refactor memoization code - pass pod as stdin rather than files Pino Toscano (3): generator: isolate memoized cache in own module generator: adjust variable names generator: improve pod2text invocation generator/Makefile.am | 3 ++ generator/memoized_cache.ml | 62 +++++++++++++++++++++ generator/memoized_cache.mli | 29 ++++++++++ generator/utils.ml | 101
2018 Aug 23
0
[PATCH v2 2/2] OCaml tools: add output selection for --machine-readable
...utils.ml +++ b/common/mlstdutils/std_utils.ml @@ -645,10 +645,6 @@ let verbose = ref false let set_verbose () = verbose := true let verbose () = !verbose -let machine_readable = ref false -let set_machine_readable () = machine_readable := true -let machine_readable () = !machine_readable - let with_open_in filename f = let chan = open_in filename in protect ~f:(fun () -> f chan) ~finally:(fun () -> close_in chan) diff --git a/common/mlstdutils/std_utils.mli b/common/mlstdutils/std_utils.mli index cb72fef7d..62cb8e9ff 100644 --- a/common/mlstdutils/std_utils.mli +++ b/common/mlstdutils/std...
2018 Aug 23
3
[PATCH v2 0/2] add output selection for --machine-readable
Hi, this adds the possibility to select the output for --machine-readable in OCaml tools. The possible choices are: * --machine-readable: to stdout, like before * --machine-readable=file:name-of-file: to the specified file * --machine-readable=stream:stdout: explicitly to stdout * --machine-readable=stream:stderr: explicitly to stderr This makes it possible to add additional output for
2018 Apr 25
9
[PATCH v2 0/9] v2v: -i ova: Handle OVAs containing snapshots.
https://bugzilla.redhat.com/show_bug.cgi?id=1570407 This turned into quite an in-depth refactoring of how we handle OVAs. It also fixes a potential security issue. Rich.