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 1212using System . Runtime . InteropServices ;
1313using System . Runtime . Versioning ;
1414
15+ using IronPython . Hosting ;
1516using IronPython . Runtime ;
1617using IronPython . Runtime . Exceptions ;
1718using IronPython . Runtime . Operations ;
@@ -370,10 +371,15 @@ public static object default_int_handlerImpl(int signalnum, TraceBackFrame? fram
370371 }
371372 }
372373
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+ }
373378 object ? last_handler = null ;
374379 lock ( GetPythonSignalState ( context ) . PySignalToPyHandler ) {
375380 // CPython returns the previous handler for the signal
376381 last_handler = getsignal ( context , signalnum ) ;
382+ if ( last_handler is null ) throw PythonNT . GetOsError ( PythonErrno . EINVAL ) ;
377383 // Set the new action
378384 GetPythonSignalState ( context ) . PySignalToPyHandler [ signalnum ] = action ;
379385 }
@@ -432,6 +438,10 @@ public PythonSignalState(PythonContext pc) {
432438 PySignalToPyHandler [ sig ] = SIG_DFL ;
433439 }
434440 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+ }
435445 }
436446 }
437447
You can’t perform that action at this time.
0 commit comments