Skip to content

Commit 9a44b68

Browse files
Sakuzyclaude
authored andcommitted
fix(audio): use file I/O by default on Windows
libsndfile reads stdin via Win32 API (GetStdHandle/ReadFile) rather than the CRT, making pipe I/O unreliable on Windows regardless of _setmode. Default to file I/O on Windows; AWMKIT_DISABLE_PIPE_IO still works as an override on all platforms. Also revert CI to stable audiowmark-win-2026-02-03 release. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 11d9e84 commit 9a44b68

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

.github/workflows/windows-winui.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ permissions:
2424
contents: read
2525

2626
env:
27-
AUDIOWMARK_WINDOWS_RELEASE: audiowmark-win-2026-02-19-binary-mode-fix
27+
AUDIOWMARK_WINDOWS_RELEASE: audiowmark-win-2026-02-03
2828
AUDIOWMARK_WINDOWS_ASSET: audiowmark-windows-x86_64.zip
2929
AUDIOWMARK_MACOS_RELEASE: audiowmark-macos-arm64-2026-02-03
3030
AUDIOWMARK_MACOS_ASSET: audiowmark-macos-arm64.tar.gz

src/audio.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,10 +1950,15 @@ fn effective_awmiomode() -> AwmIoMode {
19501950
.ok()
19511951
.is_some_and(|value| parse_env_flag(&value))
19521952
{
1953-
AwmIoMode::File
1954-
} else {
1955-
AwmIoMode::Pipe
1953+
return AwmIoMode::File;
19561954
}
1955+
// On Windows, libsndfile reads stdin via Win32 API (GetStdHandle/ReadFile)
1956+
// rather than the CRT, making pipe I/O unreliable regardless of _setmode.
1957+
// Use file I/O by default on Windows.
1958+
if cfg!(target_os = "windows") {
1959+
return AwmIoMode::File;
1960+
}
1961+
AwmIoMode::Pipe
19571962
}
19581963

19591964
/// Internal helper function.
@@ -3121,6 +3126,9 @@ mod tests {
31213126
#[test]
31223127
fn test_effective_awmiomode_respects_env() {
31233128
with_disable_pipe_env(None, || {
3129+
#[cfg(target_os = "windows")]
3130+
assert_eq!(effective_awmiomode(), AwmIoMode::File);
3131+
#[cfg(not(target_os = "windows"))]
31243132
assert_eq!(effective_awmiomode(), AwmIoMode::Pipe);
31253133
});
31263134
with_disable_pipe_env(Some("1"), || {

0 commit comments

Comments
 (0)