File tree Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
Filter options
Expand file tree Collapse file tree 3 files changed +10
-1
lines changed
Original file line number Diff line number Diff line change @@ -245,6 +245,9 @@ fn settings_from(matches: &ArgMatches) -> (Settings, RunMode) {
245
245
if name == "warn_default_encoding" {
246
246
warn_default_encoding = true
247
247
}
248
+ if name == "no_sig_int" {
249
+ settings. no_sig_int = true ;
250
+ }
248
251
let value = parts. next ( ) . map ( ToOwned :: to_owned) ;
249
252
( name, value)
250
253
} ) ) ;
Original file line number Diff line number Diff line change @@ -103,7 +103,9 @@ pub(crate) mod _signal {
103
103
. clone ( )
104
104
. get_attr ( "default_int_handler" , vm)
105
105
. expect ( "_signal does not have this attr?" ) ;
106
- signal ( libc:: SIGINT , int_handler, vm) . expect ( "Failed to set sigint handler" ) ;
106
+ if !vm. state . settings . no_sig_int {
107
+ signal ( libc:: SIGINT , int_handler, vm) . expect ( "Failed to set sigint handler" ) ;
108
+ }
107
109
}
108
110
109
111
#[ pyfunction]
Original file line number Diff line number Diff line change @@ -16,6 +16,9 @@ pub struct Settings {
16
16
/// -O optimization switch counter
17
17
pub optimize : u8 ,
18
18
19
+ /// Not set SIGINT handler(i.e. for embedded mode)
20
+ pub no_sig_int : bool ,
21
+
19
22
/// -s
20
23
pub no_user_site : bool ,
21
24
@@ -85,6 +88,7 @@ impl Default for Settings {
85
88
inspect : false ,
86
89
interactive : false ,
87
90
optimize : 0 ,
91
+ no_sig_int : false ,
88
92
no_user_site : false ,
89
93
no_site : false ,
90
94
ignore_environment : false ,
You can’t perform that action at this time.
0 commit comments