From a2dc3dbad0b9e6ee827247ee3ceefca480f5a052 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 17 Sep 2012 16:25:53 +0100 Subject: New API: rm-f: remove a file, ignoring errors if it doesn't exist. --- generator/actions.ml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'generator') diff --git a/generator/actions.ml b/generator/actions.ml index 16b1518c..a17fed0d 100644 --- a/generator/actions.ml +++ b/generator/actions.ml @@ -9802,6 +9802,33 @@ the resulting filesystem may be inconsistent or corrupt. The returned status indicates whether filesystem corruption was detected (returns C<1>) or was not detected (returns C<0>)." }; + { defaults with + name = "rm_f"; + style = RErr, [Pathname "path"], []; + proc_nr = Some 367; + tests = [ + InitScratchFS, Always, TestOutputFalse + [["mkdir"; "/rm_f"]; + ["touch"; "/rm_f/foo"]; + ["rm_f"; "/rm_f/foo"]; + ["rm_f"; "/rm_f/not_exists"]; + ["exists"; "/rm_f/foo"]]; + InitScratchFS, Always, TestLastFail + [["mkdir"; "/rm_f2"]; + ["mkdir"; "/rm_f2/foo"]; + ["rm_f"; "/rm_f2/foo"]] + ]; + shortdesc = "remove a file ignoring errors"; + longdesc = "\ +Remove the file C. + +If the file doesn't exist, that error is ignored. (Other errors, +eg. I/O errors or bad paths, are not ignored) + +This call cannot remove directories. +Use C to remove an empty directory, +or C to remove directories recursively." }; + ] (* Non-API meta-commands available only in guestfish. -- cgit