File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
src/core/IronPython.Modules Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 12
12
using System . Runtime . InteropServices ;
13
13
using System . Runtime . Versioning ;
14
14
15
+ using IronPython . Hosting ;
15
16
using IronPython . Runtime ;
16
17
using IronPython . Runtime . Exceptions ;
17
18
using IronPython . Runtime . Operations ;
@@ -370,10 +371,15 @@ public static object default_int_handlerImpl(int signalnum, TraceBackFrame? fram
370
371
}
371
372
}
372
373
374
+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) || RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ) {
375
+ // These signals cannot be handled
376
+ if ( signalnum == SIGKILL || signalnum == SIGSTOP ) throw PythonNT . GetOsError ( PythonErrno . EINVAL ) ;
377
+ }
373
378
object ? last_handler = null ;
374
379
lock ( GetPythonSignalState ( context ) . PySignalToPyHandler ) {
375
380
// CPython returns the previous handler for the signal
376
381
last_handler = getsignal ( context , signalnum ) ;
382
+ if ( last_handler is null ) throw PythonNT . GetOsError ( PythonErrno . EINVAL ) ;
377
383
// Set the new action
378
384
GetPythonSignalState ( context ) . PySignalToPyHandler [ signalnum ] = action ;
379
385
}
@@ -432,6 +438,10 @@ public PythonSignalState(PythonContext pc) {
432
438
PySignalToPyHandler [ sig ] = SIG_DFL ;
433
439
}
434
440
PySignalToPyHandler [ SIGINT ] = default_int_handler ;
441
+ if ( RuntimeInformation . IsOSPlatform ( OSPlatform . Linux ) || RuntimeInformation . IsOSPlatform ( OSPlatform . OSX ) ) {
442
+ PySignalToPyHandler [ SIGPIPE ] = SIG_IGN ;
443
+ PySignalToPyHandler [ SIGXFSZ ] = SIG_IGN ;
444
+ }
435
445
}
436
446
}
437
447
You can’t perform that action at this time.
0 commit comments