Skip to content
This repository was archived by the owner on Nov 11, 2024. It is now read-only.

Commit 80ae946

Browse files
author
Alex Rønne Petersen
committed
Add some indirection so Mono.Posix is not loaded unless needed.
Fixes #30.
1 parent ebbf70e commit 80ae946

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/CommandLine.cs

+10-2
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ static CommandLine()
6969
}
7070
}
7171

72+
internal static void SetUnixSignalAction(Signum signal, SignalAction action)
73+
{
74+
// This seemingly pointless method adds some
75+
// indirection so that we don't load `Mono.Posix`
76+
// unless we absolutely need to.
77+
Stdlib.SetSignalAction(signal, action);
78+
}
79+
7280
static void Process(string cmd, bool rc)
7381
{
7482
if (!rc && _lineEditor == null)
@@ -190,7 +198,7 @@ internal static void SetControlCHandler()
190198
}
191199
else if (_signalThread == null)
192200
{
193-
Stdlib.SetSignalAction(Signum.SIGINT, SignalAction.Default);
201+
SetUnixSignalAction(Signum.SIGINT, SignalAction.Default);
194202

195203
_signalThread = new Thread(() =>
196204
{
@@ -230,7 +238,7 @@ internal static void UnsetControlCHandler()
230238

231239
_signalThread = null;
232240

233-
Stdlib.SetSignalAction(Signum.SIGINT, SignalAction.Ignore);
241+
SetUnixSignalAction(Signum.SIGINT, SignalAction.Ignore);
234242
}
235243
}
236244

src/Program.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static int Main(string[] args)
100100
// disposition to `SIG_IGN` so that the debuggee inherits
101101
// this and doesn't die.
102102
if (!Utilities.IsWindows && !batch)
103-
Stdlib.SetSignalAction(Signum.SIGINT, SignalAction.Ignore);
103+
CommandLine.SetUnixSignalAction(Signum.SIGINT, SignalAction.Ignore);
104104

105105
CommandLine.Run(ver, batch, rc, cmds, files);
106106

0 commit comments

Comments
 (0)