[Libguestfs] [PATCH v4 8/9] mllib: add do_mv helper function to Common_utils

Pino Toscano ptoscano at redhat.com
Thu Mar 9 16:19:15 UTC 2017


On Tuesday, 7 March 2017 15:27:04 CET Cédric Bosdonnat wrote:
> ---
>  mllib/common_utils.ml  | 6 ++++++
>  mllib/common_utils.mli | 5 ++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml
> index 945728b5e..7932707c9 100644
> --- a/mllib/common_utils.ml
> +++ b/mllib/common_utils.ml
> @@ -1172,3 +1172,9 @@ let do_cp src destdir =
>    let cmd = [ "cp"; "-t"; destdir; "-a"; src ] in
>    if run_command cmd <> 0 then
>      error (f_"copy of %s to %s failed") src destdir
> +
> +let do_mv src dest =
> +  let cmd = [ "mv"; src; dest ] in
> +  let r = run_command cmd in
> +  if r <> 0 then
> +    error (f_"moving file '%s' to '%s' failed") src dest
> diff --git a/mllib/common_utils.mli b/mllib/common_utils.mli
> index 5c376fcb3..33d576b5e 100644
> --- a/mllib/common_utils.mli
> +++ b/mllib/common_utils.mli
> @@ -494,4 +494,7 @@ val inspect_decrypt : Guestfs.guestfs -> unit
>      for Fedora whole-disk encryption. *)
>  
>  val do_cp : string -> string -> unit
> -(** Run the cp command, and exit with an error if it failed *)
> +(** Run the cp command and exit with an error if it failed *)

This fix should be folder in the previous patch, i.e. the one that
moves do_cp from virt-dib to Common_utils. OTOH, the comma there fits,
so you could just leave it (and the same in the description of do_mv.)

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://listman.redhat.com/archives/libguestfs/attachments/20170309/422eec74/attachment.sig>


More information about the Libguestfs mailing list