diff rust/rhg/src/main.rs @ 46744:b1f2c2b336ec

rhg: `cat` command: print error messages for missing files And exit with an error code if no file was matched. This matches the behavior of Python-based hg. Differential Revision: https://phab.mercurial-scm.org/D10142
author Simon Sapin <simon.sapin@octobus.net>
date Wed, 03 Mar 2021 16:40:03 +0100
parents 2255e7eb39e5
children eb14264b98e8
line wrap: on
line diff
--- a/rust/rhg/src/main.rs	Mon Mar 08 19:07:29 2021 +0100
+++ b/rust/rhg/src/main.rs	Wed Mar 03 16:40:03 2021 +0100
@@ -186,6 +186,7 @@
     match result {
         Ok(()) => exitcode::OK,
         Err(CommandError::Abort { .. }) => exitcode::ABORT,
+        Err(CommandError::Unsuccessful) => exitcode::UNSUCCESSFUL,
 
         // Exit with a specific code and no error message to let a potential
         // wrapper script fallback to Python-based Mercurial.
@@ -242,6 +243,7 @@
     }
     match &result {
         Ok(_) => {}
+        Err(CommandError::Unsuccessful) => {}
         Err(CommandError::Abort { message }) => {
             if !message.is_empty() {
                 // Ignore errors when writing to stderr, we’re already exiting