Mercurial > hg
comparison rust/rhg/src/error.rs @ 49149:006688e36e12 stable
rhg: use `Command::exec` instead of `Command::status`
`rhg` is supposed to be a transparent executable, using a subprocess defeats
that purpose. See inline comments for more details.
This also introduces the `which` crate to check if the fallback executable
actually exists to help debugging (plain `execve` doesn't give much
information).
The error code 253 is used to signify that the fallback is not found, but may
mean in the future that it is otherwise invalid if we start being more
specific.
Differential Revision: https://phab.mercurial-scm.org/D12578
author | Raphaël Gomès <rgomes@octobus.net> |
---|---|
date | Tue, 19 Apr 2022 12:27:40 +0200 |
parents | ff97e793ed36 |
children | 3f86ee422095 |
comparison
equal
deleted
inserted
replaced
49148:db3f8e5cc965 | 49149:006688e36e12 |
---|---|
27 /// Encountered something (such as a CLI argument, repository layout, …) | 27 /// Encountered something (such as a CLI argument, repository layout, …) |
28 /// not supported by this version of `rhg`. Depending on configuration | 28 /// not supported by this version of `rhg`. Depending on configuration |
29 /// `rhg` may attempt to silently fall back to Python-based `hg`, which | 29 /// `rhg` may attempt to silently fall back to Python-based `hg`, which |
30 /// may or may not support this feature. | 30 /// may or may not support this feature. |
31 UnsupportedFeature { message: Vec<u8> }, | 31 UnsupportedFeature { message: Vec<u8> }, |
32 /// The fallback executable does not exist (or has some other problem if | |
33 /// we end up being more precise about broken fallbacks). | |
34 InvalidFallback { path: Vec<u8>, err: String }, | |
32 } | 35 } |
33 | 36 |
34 impl CommandError { | 37 impl CommandError { |
35 pub fn abort(message: impl AsRef<str>) -> Self { | 38 pub fn abort(message: impl AsRef<str>) -> Self { |
36 CommandError::abort_with_exit_code(message, exit_codes::ABORT) | 39 CommandError::abort_with_exit_code(message, exit_codes::ABORT) |