Skip to content

Commit

Permalink
fix(cli): add signal handler to python cli
Browse files Browse the repository at this point in the history
  • Loading branch information
gadomski committed Oct 18, 2024
1 parent e64d99c commit d5795fd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cli/src/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ use crate::Args;
use clap::Parser;
use pyo3::{
prelude::{PyModule, PyModuleMethods},
pyfunction, pymodule, wrap_pyfunction, Bound, PyResult,
pyfunction, pymodule,
types::PyAnyMethods,
wrap_pyfunction, Bound, PyResult, Python,
};

#[pyfunction]
fn main() -> PyResult<i64> {
fn main(py: Python<'_>) -> PyResult<i64> {
let signal = py.import_bound("signal")?;
let _ = signal
.getattr("signal")?
.call1((signal.getattr("SIGINT")?, signal.getattr("SIG_DFL")?))?;
let args = Args::parse_from(std::env::args_os().skip(1));
tracing_subscriber::fmt()
.with_max_level(args.log_level())
Expand Down

0 comments on commit d5795fd

Please sign in to comment.