diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index c64ed60..9824fec 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -55,6 +55,11 @@ jobs:
- name: Test
shell: bash
run: dotnet test -c Release
+ - name: Build libminipty_unix
+ if: ${{ !startsWith(matrix.rid, 'win') }}
+ shell: bash
+ run: bash scripts/build-native.sh "${{ matrix.rid }}"
+
- name: Publish and run samples (NativeAOT)
shell: bash
run: |
@@ -66,6 +71,15 @@ jobs:
exe="$out/${sample}.exe"
fi
test -f "$exe"
+ if [[ "${{ matrix.rid }}" == linux-* ]]; then
+ test ! -f "$out/libminipty_unix.so"
+ test ! -f "$out/libminipty_unix.a"
+ fi
+ if [[ "${{ matrix.rid }}" == osx-* ]]; then
+ test ! -f "$out/libminipty_unix.dylib"
+ test ! -f "$out/libminipty_unix.a"
+ test -f "$out/minipty_spawn_helper"
+ fi
"$exe"
done
@@ -145,11 +159,17 @@ jobs:
matrix:
include:
- os: ubuntu-24.04
+ rid: linux-x64
- os: ubuntu-24.04-arm
+ rid: linux-arm64
- os: windows-2025
+ rid: win-x64
- os: windows-11-arm
+ rid: win-arm64
- os: macos-26
+ rid: osx-arm64
- os: macos-26-intel
+ rid: osx-x64
permissions:
contents: read
runs-on: ${{ matrix.os }}
@@ -172,7 +192,7 @@ jobs:
path: ./publish
- name: Run NuGet smoke sample
shell: bash
- run: bash scripts/run-nuget-smoke.sh "${MINIPTY_CI_PACKAGE_VERSION}" ./publish
+ run: bash scripts/run-nuget-smoke.sh "${MINIPTY_CI_PACKAGE_VERSION}" ./publish "${{ matrix.rid }}"
build-complete:
needs: [build, nuget-smoke]
diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml
index 0e28f4d..f17c1a1 100644
--- a/.github/workflows/release.yaml
+++ b/.github/workflows/release.yaml
@@ -149,11 +149,17 @@ jobs:
matrix:
include:
- os: ubuntu-24.04
+ rid: linux-x64
- os: ubuntu-24.04-arm
+ rid: linux-arm64
- os: windows-2025
+ rid: win-x64
- os: windows-11-arm
+ rid: win-arm64
- os: macos-26
+ rid: osx-arm64
- os: macos-26-intel
+ rid: osx-x64
permissions:
contents: read
runs-on: ${{ matrix.os }}
@@ -176,7 +182,7 @@ jobs:
path: ./publish
- name: Run NuGet smoke sample
shell: bash
- run: bash scripts/run-nuget-smoke.sh "${{ needs.verify.outputs.version }}" ./publish
+ run: bash scripts/run-nuget-smoke.sh "${{ needs.verify.outputs.version }}" ./publish "${{ matrix.rid }}"
attest:
name: Attest packages
diff --git a/Directory.Build.props b/Directory.Build.props
index 15462e1..c82857d 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -10,7 +10,7 @@
true
README.md
false
- 1.1.0
+ 1.2.0
guitarrapc
© guitarrapc
pty
diff --git a/Directory.Build.targets b/Directory.Build.targets
new file mode 100644
index 0000000..30a5ecd
--- /dev/null
+++ b/Directory.Build.targets
@@ -0,0 +1,4 @@
+
+
+
diff --git a/buildTransitive/MiniPty.targets b/buildTransitive/MiniPty.targets
new file mode 100644
index 0000000..3e3b374
--- /dev/null
+++ b/buildTransitive/MiniPty.targets
@@ -0,0 +1,56 @@
+
+
+ <_MiniPtyStaticUnixRid>false
+ <_MiniPtyStaticUnixRid Condition="'$(RuntimeIdentifier)' == 'linux-x64' or '$(RuntimeIdentifier)' == 'linux-arm64' or '$(RuntimeIdentifier)' == 'osx-x64' or '$(RuntimeIdentifier)' == 'osx-arm64'">true
+
+
+
+ true
+ false
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ResolvedCopyLocalPublishAssets Remove="@(_ResolvedCopyLocalPublishAssets)"
+ Condition="$([System.String]::Copy('%(Filename)%(Extension)').Equals('libminipty_unix.so')) or $([System.String]::Copy('%(Filename)%(Extension)').Equals('libminipty_unix.dylib')) or $([System.String]::Copy('%(Filename)%(Extension)').Equals('libminipty_unix.a'))" />
+
+
+
+
diff --git a/scripts/build-native.sh b/scripts/build-native.sh
index 3a8571b..c8d03bf 100644
--- a/scripts/build-native.sh
+++ b/scripts/build-native.sh
@@ -12,12 +12,35 @@ out_dir="$root/runtimes/$rid/native"
mkdir -p "$out_dir"
+build_static_archive() {
+ local out="$1"
+ shift
+ local src
+ local work
+ local objs=()
+
+ work="$(mktemp -d)"
+ trap 'rm -rf "$work"; trap - RETURN' RETURN
+ for src in "$@"; do
+ local base
+ base="$(basename "$src")"
+ cp "$src" "$work/$base"
+ local obj="$work/${base%.c}.o"
+ cc -c -fPIC -O2 -I"$native_dir" -o "$obj" "$work/$base"
+ objs+=("$obj")
+ done
+
+ ar rcs "$out" "${objs[@]}"
+}
+
case "$rid" in
linux-*)
cc -shared -fPIC -O2 -lutil -o "$out_dir/libminipty_unix.so" "${sources[@]}"
+ build_static_archive "$out_dir/libminipty_unix.a" "${sources[@]}"
;;
osx-*)
cc -shared -fPIC -O2 -lutil -o "$out_dir/libminipty_unix.dylib" "${sources[@]}"
+ build_static_archive "$out_dir/libminipty_unix.a" "${sources[@]}"
cc -O2 -o "$out_dir/minipty_spawn_helper" "$native_dir/minipty_spawn_helper.c" "$native_dir/minipty_unix_exec.c"
;;
win-*)
diff --git a/scripts/pack-with-native.sh b/scripts/pack-with-native.sh
index 462bfb8..b57a0f2 100644
--- a/scripts/pack-with-native.sh
+++ b/scripts/pack-with-native.sh
@@ -8,10 +8,14 @@ root="$(cd "$(dirname "$0")/.." && pwd)"
required=(
"linux-x64/native/libminipty_unix.so"
+ "linux-x64/native/libminipty_unix.a"
"linux-arm64/native/libminipty_unix.so"
+ "linux-arm64/native/libminipty_unix.a"
"osx-x64/native/libminipty_unix.dylib"
+ "osx-x64/native/libminipty_unix.a"
"osx-x64/native/minipty_spawn_helper"
"osx-arm64/native/libminipty_unix.dylib"
+ "osx-arm64/native/libminipty_unix.a"
"osx-arm64/native/minipty_spawn_helper"
)
diff --git a/scripts/run-nuget-smoke.sh b/scripts/run-nuget-smoke.sh
index 70d1619..f4d0602 100644
--- a/scripts/run-nuget-smoke.sh
+++ b/scripts/run-nuget-smoke.sh
@@ -1,8 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail
-version="${1:?Usage: run-nuget-smoke.sh }"
-feed_dir="${2:?Usage: run-nuget-smoke.sh }"
+version="${1:?Usage: run-nuget-smoke.sh [runtime-identifier]}"
+feed_dir="${2:?Usage: run-nuget-smoke.sh [runtime-identifier]}"
+rid="${3:-}"
version="${version#v}"
to_dotnet_path() {
@@ -63,3 +64,25 @@ cat > "$tmp/NuGetSmoke.csproj" <false
<_MiniPtyRuntimesRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)..\..\runtimes'))
false
+ false
true
libminipty_unix.dylib
libminipty_unix.so
@@ -33,6 +34,7 @@
@@ -45,6 +47,12 @@
PackagePath="runtimes/osx-x64/native" />
+
+
+
+
@@ -56,7 +64,7 @@
$(MiniPtyUnixNativeLibraryName)
PreserveNewest
- PreserveNewest
+ PreserveNewest
diff --git a/tests/MiniPty.Tests/PtyTests.cs b/tests/MiniPty.Tests/PtyTests.cs
index 73f7870..ed90d79 100644
--- a/tests/MiniPty.Tests/PtyTests.cs
+++ b/tests/MiniPty.Tests/PtyTests.cs
@@ -1041,10 +1041,11 @@ public async Task PtyChildSeesResizedSize()
if (!TryResolveWindowsPowerShell(out var powershell))
return;
+ // Block on stdin until after Resize so a fast runner cannot query size before ConPTY applies it.
await using var session = Pty.Start(
- Spawn(powershell, ["-NoLogo", "-NoProfile", "-Command", "$s = $Host.UI.RawUI.WindowSize; Start-Sleep -Milliseconds 200; Write-Output (\"{0} {1}\" -f $s.Width, $s.Height); exit 0"]));
+ Spawn(powershell, ["-NoLogo", "-NoProfile", "-Command", "[Console]::In.ReadLine() | Out-Null; $s = $Host.UI.RawUI.WindowSize; Write-Output (\"{0} {1}\" -f $s.Width, $s.Height); exit 0"]));
session.Resize(new(100, 30));
- var result = await session.CompleteAsync();
+ var result = await session.CompleteAsync(new PtyCompleteOptions { Input = "go\r\n" });
await Assert.That(result.ExitCode).IsEqualTo(0);
await Assert.That(result.Contains("100 30")).IsTrue();