Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CliWrap/CliWrap.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
Condition="$([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)', 'net7.0'))"
>true</IsAotCompatible
>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>

<PropertyGroup>
Expand Down
11 changes: 9 additions & 2 deletions CliWrap/Utils/NativeMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

namespace CliWrap.Utils;

internal static class NativeMethods
internal static partial class NativeMethods
{
public static class Unix
public static partial class Unix
{
// LibraryImport's source generator doesn't emit an implementation for pre-.NET 7 targets
// because the generated code relies on runtime APIs introduced in .NET 7.
#if NET7_0_OR_GREATER
[LibraryImport("libc", EntryPoint = "kill", SetLastError = true)]
public static partial int Kill(int pid, int sig);
#else
[DllImport("libc", EntryPoint = "kill", SetLastError = true)]
public static extern int Kill(int pid, int sig);
#endif
}
}
Loading