diff options
author | Richard W.M. Jones <rjones@redhat.com> | 2011-08-19 10:06:00 +0100 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2011-08-19 10:08:21 +0100 |
commit | 57b3004bde579b986523c43e3a0e6693fd49dd21 (patch) | |
tree | 8bd8375f044e73d6467da9ad9a053966ad54e19b /febootstrap_utils.ml | |
parent | 50742fae18d8dd699ac6aaa7fe0800b6a6ec55cf (diff) | |
download | febootstrap-57b3004bde579b986523c43e3a0e6693fd49dd21.tar.gz febootstrap-57b3004bde579b986523c43e3a0e6693fd49dd21.tar.xz febootstrap-57b3004bde579b986523c43e3a0e6693fd49dd21.zip |
febootstrap: Add --save-temps option to save temporary files on exit.
Diffstat (limited to 'febootstrap_utils.ml')
-rw-r--r-- | febootstrap_utils.ml | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/febootstrap_utils.ml b/febootstrap_utils.ml index 04c91ad..2265753 100644 --- a/febootstrap_utils.ml +++ b/febootstrap_utils.ml @@ -90,10 +90,14 @@ let tmpdir () = *) let tmpdir = Filename.temp_dir_name // sprintf "febootstrap%s.tmp" data in Unix.mkdir tmpdir 0o700; - at_exit - (fun () -> - let cmd = sprintf "rm -rf %s" (Filename.quote tmpdir) in - ignore (Sys.command cmd)); + + (* Only remove the directory if --save-temps was *not* specified. *) + if not Febootstrap_cmdline.save_temps then + at_exit + (fun () -> + let cmd = sprintf "rm -rf %s" (Filename.quote tmpdir) in + ignore (Sys.command cmd)); + tmpdir let rec find s sub = |