diff options
Diffstat (limited to 'Userland/Utilities/rm.cpp')
-rw-r--r-- | Userland/Utilities/rm.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Userland/Utilities/rm.cpp b/Userland/Utilities/rm.cpp index dd05c0719d..01f7b2be85 100644 --- a/Userland/Utilities/rm.cpp +++ b/Userland/Utilities/rm.cpp @@ -25,7 +25,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) Core::ArgsParser args_parser; args_parser.add_option(recursive, "Delete directories recursively", "recursive", 'r'); - args_parser.add_option(force, "Force", "force", 'f'); + args_parser.add_option(force, "Ignore nonexistent files", "force", 'f'); args_parser.add_option(verbose, "Verbose", "verbose", 'v'); args_parser.add_option(no_preserve_root, "Do not consider '/' specially", "no-preserve-root", 0); args_parser.add_positional_argument(paths, "Path(s) to remove", "path", Core::ArgsParser::Required::No); @@ -43,10 +43,15 @@ ErrorOr<int> serenity_main(Main::Arguments arguments) continue; } - auto result = Core::File::remove(path, recursive ? Core::File::RecursionMode::Allowed : Core::File::RecursionMode::Disallowed, force); + auto result = Core::File::remove(path, recursive ? Core::File::RecursionMode::Allowed : Core::File::RecursionMode::Disallowed); if (result.is_error()) { - warnln("rm: cannot remove '{}': {}", path, static_cast<Error const&>(result.error())); + auto error = result.error(); + + if (force && error.is_errno() && error.code() == ENOENT) + continue; + + warnln("rm: cannot remove '{}': {}", path, error); had_errors = true; } |