[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Libguestfs] [PATCH v2 6/8] Replace 'xs := x :: !xs' with 'unshift x xs'.



In one case, I used prepend instead.
---
 builder/builder.ml                   |  2 +-
 builder/cmdline.ml                   |  8 ++++----
 builder/languages.ml                 |  6 +++---
 builder/sigchecker.ml                |  4 +---
 customize/customize_main.ml          |  4 ++--
 dib/cmdline.ml                       | 17 ++++++-----------
 generator/customize.ml               | 20 ++++++++++----------
 resize/resize.ml                     |  4 ++--
 sparsify/cmdline.ml                  |  4 ++--
 sysprep/main.ml                      |  2 +-
 sysprep/sysprep_operation.ml         |  4 ++--
 sysprep/sysprep_operation_script.ml  |  2 +-
 v2v/cmdline.ml                       |  6 +++---
 v2v/convert_linux.ml                 | 10 +++++-----
 v2v/convert_windows.ml               |  2 +-
 v2v/copy_to_local.ml                 |  4 ++--
 v2v/input_libvirtxml.ml              | 11 ++++++-----
 v2v/input_ova.ml                     |  6 +++---
 v2v/modules_list.ml                  | 10 +++++-----
 v2v/output_libvirt.ml                |  2 +-
 v2v/test-harness/v2v_test_harness.ml |  6 +++---
 21 files changed, 64 insertions(+), 70 deletions(-)

diff --git a/builder/builder.ml b/builder/builder.ml
index e95fcd1..b4229d6 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -405,7 +405,7 @@ let main () =
     let is_not t = not (is t) in
     let remove = List.remove_assoc in
     let ret = ref [] in
-    let tr task weight otags = ret := (task, weight, otags) :: !ret in
+    let tr task weight otags = unshift (task, weight, otags) ret in
 
     (* XXX Weights are not very smartly chosen.  At the moment I'm
      * using a range [0..100] where 0 = free and 100 = expensive.  We
diff --git a/builder/cmdline.ml b/builder/cmdline.ml
index eee8367..93ac179 100644
--- a/builder/cmdline.ml
+++ b/builder/cmdline.ml
@@ -71,7 +71,7 @@ let parse_cmdline () =
     | "auto" -> attach_format := None
     | s -> attach_format := Some s
   in
-  let attach_disk s = attach := (!attach_format, s) :: !attach in
+  let attach_disk s = unshift (!attach_format, s) attach in
 
   let cache = ref Paths.xdg_cache_home in
   let set_cache arg = cache := Some arg in
@@ -83,7 +83,7 @@ let parse_cmdline () =
   let delete_on_failure = ref true in
 
   let fingerprints = ref [] in
-  let add_fingerprint arg = fingerprints := arg :: !fingerprints in
+  let add_fingerprint arg = unshift arg fingerprints in
 
   let format = ref "" in
   let gpg = ref "gpg" in
@@ -113,7 +113,7 @@ let parse_cmdline () =
   let set_smp arg = smp := Some arg in
 
   let sources = ref [] in
-  let add_source arg = sources := arg :: !sources in
+  let add_source arg = unshift arg sources in
 
   let sync = ref true in
   let warn_if_partition = ref true in
@@ -175,7 +175,7 @@ let parse_cmdline () =
   let argspec = set_standard_options argspec in
 
   let args = ref [] in
-  let anon_fun s = args := s :: !args in
+  let anon_fun s = unshift s args in
   let usage_msg =
     sprintf (f_"\
 %s: build virtual machine images quickly
diff --git a/builder/languages.ml b/builder/languages.ml
index 37acf83..5e1d70a 100644
--- a/builder/languages.ml
+++ b/builder/languages.ml
@@ -30,10 +30,10 @@ let split_locale loc =
     let territory = match_or_empty 3 in
     (match territory with
     | "" -> ()
-    | territory -> l := (lang ^ "_" ^ territory) :: !l);
-    l := lang :: !l;
+    | territory -> unshift (lang ^ "_" ^ territory) l);
+    unshift lang l;
   );
-  l := "" :: !l;
+  unshift "" l;
   List.rev !l
 
 let languages () =
diff --git a/builder/sigchecker.ml b/builder/sigchecker.ml
index 94727d6..e2a3b5f 100644
--- a/builder/sigchecker.ml
+++ b/builder/sigchecker.ml
@@ -80,9 +80,7 @@ let import_keyfile ~gpg ~gpghome ?(trust = true) keyfile =
           (match !current with
           | None -> ()
           | Some k ->
-            if String.is_suffix id k then (
-              subkeys := id :: !subkeys;
-            );
+            if String.is_suffix id k then unshift id subkeys;
             current := None
           )
         | _ -> ()
diff --git a/customize/customize_main.ml b/customize/customize_main.ml
index 5b7712e..6b58aea 100644
--- a/customize/customize_main.ml
+++ b/customize/customize_main.ml
@@ -38,7 +38,7 @@ let main () =
     | "auto" -> attach_format := None
     | s -> attach_format := Some s
   in
-  let attach_disk s = attach := (!attach_format, s) :: !attach in
+  let attach_disk s = unshift (!attach_format, s) attach in
   let domain = ref None in
   let dryrun = ref false in
   let files = ref [] in
@@ -62,7 +62,7 @@ let main () =
         error (f_"error parsing URI '%s'. Look for error messages printed above.")
           arg in
     let format = match !format with "auto" -> None | fmt -> Some fmt in
-    files := (uri, format) :: !files;
+    unshift (uri, format) files;
     format_consumed := true
   and set_domain dom =
     if !domain <> None then
diff --git a/dib/cmdline.ml b/dib/cmdline.ml
index 3a97366..f51a20d 100644
--- a/dib/cmdline.ml
+++ b/dib/cmdline.ml
@@ -68,20 +68,16 @@ read the man page virt-dib(1).
       prog in
 
   let elements = ref [] in
-  let append_element element =
-    elements := element :: !elements in
+  let append_element element = unshift element elements in
 
   let excluded_elements = ref [] in
-  let append_excluded_element element =
-    excluded_elements := element :: !excluded_elements in
+  let append_excluded_element element = unshift element excluded_elements in
 
   let element_paths = ref [] in
-  let append_element_path arg =
-    element_paths := arg :: !element_paths in
+  let append_element_path arg = unshift arg element_paths in
 
   let excluded_scripts = ref [] in
-  let append_excluded_script arg =
-    excluded_scripts := arg :: !excluded_scripts in
+  let append_excluded_script arg = unshift arg excluded_scripts in
 
   let debug = ref 0 in
   let set_debug arg =
@@ -118,8 +114,7 @@ read the man page virt-dib(1).
     formats := fmts in
 
   let envvars = ref [] in
-  let append_envvar arg =
-    envvars := arg :: !envvars in
+  let append_envvar arg = unshift arg envvars in
 
   let use_base = ref true in
 
@@ -153,7 +148,7 @@ read the man page virt-dib(1).
 
   let extra_packages = ref [] in
   let append_extra_packages arg =
-    extra_packages := List.rev (String.nsplit "," arg) @ !extra_packages in
+    prepend (List.rev (String.nsplit "," arg)) extra_packages in
 
   let argspec = [
     "-p",           Arg.String append_element_path, "path" ^ " " ^ s_"Add new a elements location";
diff --git a/generator/customize.ml b/generator/customize.ml
index 5db76d5..b4b12c4 100644
--- a/generator/customize.ml
+++ b/generator/customize.ml
@@ -653,7 +653,7 @@ let rec argspec () =
         op_shortdesc = shortdesc; op_pod_longdesc = longdesc } ->
       pr "    (\n";
       pr "      \"--%s\",\n" name;
-      pr "      Arg.Unit (fun () -> ops := %s :: !ops),\n" discrim;
+      pr "      Arg.Unit (fun () -> unshift %s ops),\n" discrim;
       pr "      \" \" ^ s_\"%s\"\n" shortdesc;
       pr "    ),\n";
       pr "    None, %S;\n" longdesc
@@ -661,7 +661,7 @@ let rec argspec () =
         op_shortdesc = shortdesc; op_pod_longdesc = longdesc } ->
       pr "    (\n";
       pr "      \"--%s\",\n" name;
-      pr "      Arg.String (fun s -> ops := %s s :: !ops),\n" discrim;
+      pr "      Arg.String (fun s -> unshift (%s s) ops),\n" discrim;
       pr "      s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc;
       pr "    ),\n";
       pr "    Some %S, %S;\n" v longdesc
@@ -672,7 +672,7 @@ let rec argspec () =
       pr "      Arg.String (\n";
       pr "        fun s ->\n";
       pr "          let p = split_string_pair \"%s\" s in\n" name;
-      pr "          ops := %s p :: !ops\n" discrim;
+      pr "          unshift (%s p) ops\n" discrim;
       pr "      ),\n";
       pr "      s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc;
       pr "    ),\n";
@@ -684,7 +684,7 @@ let rec argspec () =
       pr "      Arg.String (\n";
       pr "        fun s ->\n";
       pr "          let ss = split_string_list s in\n";
-      pr "          ops := %s ss :: !ops\n" discrim;
+      pr "          unshift (%s ss) ops\n" discrim;
       pr "      ),\n";
       pr "      s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc;
       pr "    ),\n";
@@ -696,7 +696,7 @@ let rec argspec () =
       pr "      Arg.String (\n";
       pr "        fun s ->\n";
       pr "          let ss = split_links_list \"%s\" s in\n" name;
-      pr "          ops := %s ss :: !ops\n" discrim;
+      pr "          unshift (%s ss) ops\n" discrim;
       pr "      ),\n";
       pr "      s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc;
       pr "    ),\n";
@@ -708,7 +708,7 @@ let rec argspec () =
       pr "      Arg.String (\n";
       pr "        fun s ->\n";
       pr "          let sel = Password.parse_selector s in\n";
-      pr "          ops := %s sel :: !ops\n" discrim;
+      pr "          unshift (%s sel) ops\n" discrim;
       pr "      ),\n";
       pr "      s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc;
       pr "    ),\n";
@@ -721,7 +721,7 @@ let rec argspec () =
       pr "        fun s ->\n";
       pr "          let user, sel = split_string_pair \"%s\" s in\n" name;
       pr "          let sel = Password.parse_selector sel in\n";
-      pr "          ops := %s (user, sel) :: !ops\n" discrim;
+      pr "          unshift (%s (user, sel)) ops\n" discrim;
       pr "      ),\n";
       pr "      s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc;
       pr "    ),\n";
@@ -734,7 +734,7 @@ let rec argspec () =
       pr "        fun s ->\n";
       pr "          let user, selstr = String.split \":\" s in\n";
       pr "          let sel = Ssh_key.parse_selector selstr in\n";
-      pr "          ops := %s (user, sel) :: !ops\n" discrim;
+      pr "          unshift (%s (user, sel)) ops\n" discrim;
       pr "      ),\n";
       pr "      s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc;
       pr "    ),\n";
@@ -746,7 +746,7 @@ let rec argspec () =
       pr "      Arg.String (\n";
       pr "        fun s ->\n";
       pr "          %s s;\n" fn;
-      pr "          ops := %s s :: !ops\n" discrim;
+      pr "          unshift (%s s) ops\n" discrim;
       pr "      ),\n";
       pr "      s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc;
       pr "    ),\n";
@@ -758,7 +758,7 @@ let rec argspec () =
       pr "      Arg.String (\n";
       pr "        fun s ->\n";
       pr "          let sel = Subscription_manager.parse_pool_selector s in\n";
-      pr "          ops := %s sel :: !ops\n" discrim;
+      pr "          unshift (%s sel) ops\n" discrim;
       pr "      ),\n";
       pr "      s_\"%s\" ^ \" \" ^ s_\"%s\"\n" v shortdesc;
       pr "    ),\n";
diff --git a/resize/resize.ml b/resize/resize.ml
index 22386ce..fb98c17 100644
--- a/resize/resize.ml
+++ b/resize/resize.ml
@@ -150,7 +150,7 @@ let main () =
     lv_expands, machine_readable, ntfsresize_force, output_format,
     resizes, resizes_force, shrink, sparse, unknown_fs_mode =
 
-    let add xs s = xs := s :: !xs in
+    let add xs s = unshift s xs in
 
     let align_first = ref "auto" in
     let alignment = ref 128 in
@@ -214,7 +214,7 @@ let main () =
     ] in
     let argspec = set_standard_options argspec in
     let disks = ref [] in
-    let anon_fun s = disks := s :: !disks in
+    let anon_fun s = unshift s disks in
     let usage_msg =
       sprintf (f_"\
 %s: resize a virtual machine disk
diff --git a/sparsify/cmdline.ml b/sparsify/cmdline.ml
index bd49e71..1855fa6 100644
--- a/sparsify/cmdline.ml
+++ b/sparsify/cmdline.ml
@@ -41,7 +41,7 @@ and mode_t =
 and check_t = [`Ignore|`Continue|`Warn|`Fail]
 
 let parse_cmdline () =
-  let add xs s = xs := s :: !xs in
+  let add xs s = unshift s xs in
 
   let check_tmpdir = ref `Warn in
   let set_check_tmpdir = function
@@ -79,7 +79,7 @@ let parse_cmdline () =
   ] in
   let argspec = set_standard_options argspec in
   let disks = ref [] in
-  let anon_fun s = disks := s :: !disks in
+  let anon_fun s = unshift s disks in
   let usage_msg =
     sprintf (f_"\
 %s: sparsify a virtual machine disk
diff --git a/sysprep/main.ml b/sysprep/main.ml
index 35a259c..c8db653 100644
--- a/sysprep/main.ml
+++ b/sysprep/main.ml
@@ -56,7 +56,7 @@ let main () =
         with Invalid_argument "URI.parse_uri" ->
           error (f_"error parsing URI '%s'. Look for error messages printed above.") arg in
       let format = match !format with "auto" -> None | fmt -> Some fmt in
-      files := (uri, format) :: !files;
+      unshift (uri, format) files;
       format_consumed := true
     and set_domain dom =
       if !domain <> None then
diff --git a/sysprep/sysprep_operation.ml b/sysprep/sysprep_operation.ml
index 057c8c5..806e9d8 100644
--- a/sysprep/sysprep_operation.ml
+++ b/sysprep/sysprep_operation.ml
@@ -109,9 +109,9 @@ let remove_all_from_set set =
   empty_set
 
 let register_operation op =
-  all_operations := op :: !all_operations;
+  unshift op all_operations;
   if op.enabled_by_default then
-    enabled_by_default_operations := op :: !enabled_by_default_operations
+    unshift op enabled_by_default_operations
 
 let baked = ref false
 let rec bake () =
diff --git a/sysprep/sysprep_operation_script.ml b/sysprep/sysprep_operation_script.ml
index 140225c..f7f6e88 100644
--- a/sysprep/sysprep_operation_script.ml
+++ b/sysprep/sysprep_operation_script.ml
@@ -33,7 +33,7 @@ let set_scriptdir dir =
   scriptdir := Some dir
 
 let scripts = ref []
-let add_script script = scripts := script :: !scripts
+let add_script script = unshift script scripts
 
 let rec script_perform (g : Guestfs.guestfs) root side_effects =
   let scripts = List.rev !scripts in
diff --git a/v2v/cmdline.ml b/v2v/cmdline.ml
index 1064987..558ace4 100644
--- a/v2v/cmdline.ml
+++ b/v2v/cmdline.ml
@@ -150,10 +150,10 @@ let parse_cmdline () =
   in
 
   let vdsm_image_uuids = ref [] in
-  let add_vdsm_image_uuid s = vdsm_image_uuids := s :: !vdsm_image_uuids in
+  let add_vdsm_image_uuid s = unshift s vdsm_image_uuids in
 
   let vdsm_vol_uuids = ref [] in
-  let add_vdsm_vol_uuid s = vdsm_vol_uuids := s :: !vdsm_vol_uuids in
+  let add_vdsm_vol_uuid s = unshift s vdsm_vol_uuids in
 
   let vmtype_warning _ =
     warning (f_"the --vmtype option has been removed and now does nothing")
@@ -216,7 +216,7 @@ let parse_cmdline () =
   ] in
   let argspec = set_standard_options argspec in
   let args = ref [] in
-  let anon_fun s = args := s :: !args in
+  let anon_fun s = unshift s args in
   let usage_msg =
     sprintf (f_"\
 %s: convert a guest to use KVM
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index a5ba8dd..90f9543 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -555,13 +555,13 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
     List.iter (
       fun { G.app2_name = name } ->
         if String.is_prefix name "vmware-tools-libraries-" then
-          libraries := name :: !libraries
+          unshift name libraries
         else if String.is_prefix name "vmware-tools-" then
-          remove := name :: !remove
+          unshift name remove
         else if name = "VMwareTools" then
-          remove := name :: !remove
+          unshift name remove
         else if String.is_prefix name "kmod-vmware-tools" then
-          remove := name :: !remove
+          unshift name remove
     ) inspect.i_apps;
     let libraries = !libraries in
 
@@ -601,7 +601,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
             let cmd = Array.of_list cmd in
             (try
                ignore (g#command cmd);
-               remove := library :: !remove
+               unshift library remove
              with G.Error msg ->
                eprintf "%s: could not install replacement for %s.  Error was: %s.  %s was not removed.\n"
                  prog library msg library
diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml
index e5e4dc7..34fe9cb 100644
--- a/v2v/convert_windows.ml
+++ b/v2v/convert_windows.ml
@@ -196,7 +196,7 @@ let convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
                       * uninstaller still shows a no-way-out reboot dialog *)
                      " PREVENT_REBOOT=Yes LAUNCHED_BY_SETUP_EXE=Yes" in
 
-               uninsts := uninst :: !uninsts
+               unshift uninst uninsts
              with
                Not_found -> ()
          ) uninstnodes
diff --git a/v2v/copy_to_local.ml b/v2v/copy_to_local.ml
index 24ed03f..91e4b58 100644
--- a/v2v/copy_to_local.ml
+++ b/v2v/copy_to_local.ml
@@ -48,7 +48,7 @@ let rec main () =
   ] in
   let argspec = set_standard_options argspec in
   let args = ref [] in
-  let anon_fun s = args := s :: !args in
+  let anon_fun s = unshift s args in
   let usage_msg =
     sprintf (f_"\
 %s: copy a remote guest to the local machine
@@ -259,7 +259,7 @@ and parse_libvirt_xml guest_name xml =
       incr i;
       let local_disk = sprintf "%s-disk%d" guest_name !i in
 
-      disks := (remote_disk, local_disk) :: !disks;
+      unshift (remote_disk, local_disk) disks;
       local_disk
     in
     get_disks, add_disk
diff --git a/v2v/input_libvirtxml.ml b/v2v/input_libvirtxml.ml
index 552bd9f..a1fa96a 100644
--- a/v2v/input_libvirtxml.ml
+++ b/v2v/input_libvirtxml.ml
@@ -76,7 +76,7 @@ let parse_libvirt_xml ?conn xml =
     let nr_nodes = Xml.xpathobj_nr_nodes obj in
     for i = 0 to nr_nodes-1 do
       let node = Xml.xpathobj_node obj i in
-      features := Xml.node_name node :: !features
+      unshift (Xml.node_name node) features
     done;
     !features in
 
@@ -193,11 +193,12 @@ let parse_libvirt_xml ?conn xml =
       let get_disks () = List.rev !disks in
       let add_disk qemu_uri format controller p_source =
         incr i;
-        disks :=
+        unshift
           { p_source_disk = { s_disk_id = !i;
                               s_qemu_uri = qemu_uri; s_format = format;
                               s_controller = controller };
-            p_source = p_source } :: !disks
+            p_source = p_source }
+          disks
       in
       get_disks, add_disk
     in
@@ -334,7 +335,7 @@ let parse_libvirt_xml ?conn xml =
         { s_removable_type = typ;
           s_removable_controller = controller;
           s_removable_slot = slot } in
-      disks := disk :: !disks
+      unshift disk disks
     done;
     List.rev !disks in
 
@@ -378,7 +379,7 @@ let parse_libvirt_xml ?conn xml =
              s_vnet_orig = vnet;
              s_vnet_type = vnet_type
            } in
-           nics := nic :: !nics
+           unshift nic nics
          in
          match xpath_string "source/@network | source/@bridge" with
          | None -> ()
diff --git a/v2v/input_ova.ml b/v2v/input_ova.ml
index 8a5886c..f3d35c4 100644
--- a/v2v/input_ova.ml
+++ b/v2v/input_ova.ml
@@ -287,7 +287,7 @@ object
             s_format = Some "vmdk";
             s_controller = controller;
           } in
-          disks := disk :: !disks;
+          unshift disk disks;
         ) else
           error (f_"could not parse disk rasd:HostResource from OVF document")
       done in
@@ -331,7 +331,7 @@ object
           s_removable_controller = controller;
           s_removable_slot = slot;
         } in
-        removables := disk :: !removables;
+        unshift disk removables;
       done in
     let removables = List.rev !removables in
 
@@ -351,7 +351,7 @@ object
         s_vnet_orig = vnet;
         s_vnet_type = Network;
       } in
-      nics := nic :: !nics
+      unshift nic nics
     done;
 
     let source = {
diff --git a/v2v/modules_list.ml b/v2v/modules_list.ml
index fd7b2ff..30b044e 100644
--- a/v2v/modules_list.ml
+++ b/v2v/modules_list.ml
@@ -16,13 +16,13 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  *)
 
+open Common_utils
+
 let input_modules = ref []
 and output_modules = ref []
 
-let register_input_module name =
-  input_modules := name :: !input_modules
-and register_output_module name =
-  output_modules := name :: !output_modules
+let register_input_module name = unshift name input_modules
+and register_output_module name = unshift name output_modules
 
 let input_modules () = List.sort compare !input_modules
 and output_modules () = List.sort compare !output_modules
@@ -35,7 +35,7 @@ type conversion_fn =
 let convert_modules = ref []
 
 let register_convert_module inspect_fn name conversion_fn =
-  convert_modules := (inspect_fn, (name, conversion_fn)) :: !convert_modules
+  unshift (inspect_fn, (name, conversion_fn)) convert_modules
 
 let find_convert_module inspect =
   let rec loop = function
diff --git a/v2v/output_libvirt.ml b/v2v/output_libvirt.ml
index e7067d7..69cdd2b 100644
--- a/v2v/output_libvirt.ml
+++ b/v2v/output_libvirt.ml
@@ -64,7 +64,7 @@ let target_features_of_capabilities_doc doc arch =
     for i = 0 to Xml.xpathobj_nr_nodes obj - 1 do
       let feature_node = Xml.xpathobj_node obj i in
       let feature_name = Xml.node_name feature_node in
-      features := feature_name :: !features
+      unshift feature_name features
     done;
     !features
   )
diff --git a/v2v/test-harness/v2v_test_harness.ml b/v2v/test-harness/v2v_test_harness.ml
index 70ce73e..f774978 100644
--- a/v2v/test-harness/v2v_test_harness.ml
+++ b/v2v/test-harness/v2v_test_harness.ml
@@ -94,7 +94,7 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () =
   let nodes_of_xpathobj doc xpathobj =
     let nodes = ref [] in
     for i = 0 to Xml.xpathobj_nr_nodes xpathobj - 1 do
-      nodes := Xml.xpathobj_node xpathobj i :: !nodes
+      unshift (Xml.xpathobj_node xpathobj i) nodes
     done;
     List.rev !nodes
   in
@@ -210,7 +210,7 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () =
       printf "%s\n%!" cmd;
       let chan = open_process_in cmd in
       let lines = ref [] in
-      (try while true do lines := input_line chan :: !lines done
+      (try while true do unshift (input_line chan) lines done
        with End_of_file -> ());
       let lines = List.rev !lines in
       let stat = close_process_in chan in
@@ -283,7 +283,7 @@ let run ~test ?input_disk ?input_xml ?(test_plan = default_plan) () =
       printf "%s\n%!" cmd;
       let chan = open_process_in cmd in
       let lines = ref [] in
-      (try while true do lines := input_line chan :: !lines done
+      (try while true do unshift (input_line chan) lines done
        with End_of_file -> ());
       let lines = List.rev !lines in
       let stat = close_process_in chan in
-- 
2.7.4


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]