Mercurial > hg
view rust/hgcli/src/main.rs @ 48998:91a60031aba2 stable
dispatch: fix silly blackbox entries when hg is interrupted
When hg is interrupted, it creates ui.log like this:
1970/01/01 00:00:00 user @0000000000000000000000000000000000000000 (62488)> killed!
exited 255 after 1.78 seconds
This is due to a scoping problem: two different uses of the name "msg"
collide. So rename one of them.
Differential Revision: https://phab.mercurial-scm.org/D12427
author | Valentin Gatien-Baron <vgatien-baron@janestreet.com> |
---|---|
date | Fri, 01 Apr 2022 12:46:58 -0400 |
parents | 426294d06ddc |
children |
line wrap: on
line source
use pyembed::MainPythonInterpreter; // Include an auto-generated file containing the default // `pyembed::PythonConfig` derived by the PyOxidizer configuration file. // // If you do not want to use PyOxidizer to generate this file, simply // remove this line and instantiate your own instance of // `pyembed::PythonConfig`. include!(env!("PYOXIDIZER_DEFAULT_PYTHON_CONFIG_RS")); fn main() { // The following code is in a block so the MainPythonInterpreter is // destroyed in an orderly manner, before process exit. let code = { // Load the default Python configuration as derived by the PyOxidizer // config file used at build time. let config = default_python_config(); // Construct a new Python interpreter using that config, handling any // errors from construction. match MainPythonInterpreter::new(config) { Ok(mut interp) => { // And run it using the default run configuration as specified // by the configuration. If an uncaught Python // exception is raised, handle it. // This includes the special SystemExit, which is a request to // terminate the process. interp.run_as_main() } Err(msg) => { eprintln!("{}", msg); 1 } } }; // And exit the process according to code execution results. std::process::exit(code); }