diff --git a/src/Ytdlp.NET/Ytdlp/Ytdlp.Execute.cs b/src/Ytdlp.NET/Ytdlp/Ytdlp.Execute.cs index 8ad1d61..792eafd 100644 --- a/src/Ytdlp.NET/Ytdlp/Ytdlp.Execute.cs +++ b/src/Ytdlp.NET/Ytdlp/Ytdlp.Execute.cs @@ -19,6 +19,8 @@ public async Task ExecuteRawAsync(string arguments, CancellationToken ct = default, bool tuneProcess = true) { + ct.ThrowIfCancellationRequested(); + if (string.IsNullOrWhiteSpace(arguments)) throw new ArgumentException("Arguments cannot be null or empty.", nameof(arguments)); diff --git a/src/Ytdlp.NET/Ytdlp/Ytdlp.Probe.cs b/src/Ytdlp.NET/Ytdlp/Ytdlp.Probe.cs index 040d4b8..eda6842 100644 --- a/src/Ytdlp.NET/Ytdlp/Ytdlp.Probe.cs +++ b/src/Ytdlp.NET/Ytdlp/Ytdlp.Probe.cs @@ -429,6 +429,8 @@ public async Task> GetSubtitlesAsync(string url, Cancellatio { try { + ct.ThrowIfCancellationRequested(); + var result = await CreateRunner().ExecuteAsync( arguments, onLineReceived: null, diff --git a/tests/Ytdlp.NET.Test/ArgumentTests.cs b/tests/Ytdlp.NET.Test/ArgumentTests.cs index 0025e6c..26a8300 100644 --- a/tests/Ytdlp.NET.Test/ArgumentTests.cs +++ b/tests/Ytdlp.NET.Test/ArgumentTests.cs @@ -20,7 +20,7 @@ public ArgumentTests() { try { - File.WriteAllText(_fullFakePath, ""); + File.WriteAllText(_fullFakePath, "fake yt-dlp executable"); } catch (IOException) { diff --git a/tests/Ytdlp.NET.Test/AudioFormatTests.cs b/tests/Ytdlp.NET.Test/AudioFormatTests.cs index 10e7e46..10f8310 100644 --- a/tests/Ytdlp.NET.Test/AudioFormatTests.cs +++ b/tests/Ytdlp.NET.Test/AudioFormatTests.cs @@ -24,7 +24,7 @@ public AudioFormatTests() { try { - File.WriteAllText(_fullFakePath, ""); + File.WriteAllText(_fullFakePath, "fake yt-dlp executable"); } catch (IOException) { diff --git a/tests/Ytdlp.NET.Test/YtdlpAdobeAuthTests.cs b/tests/Ytdlp.NET.Test/YtdlpAdobeAuthTests.cs index cc5f215..6604610 100644 --- a/tests/Ytdlp.NET.Test/YtdlpAdobeAuthTests.cs +++ b/tests/Ytdlp.NET.Test/YtdlpAdobeAuthTests.cs @@ -17,7 +17,7 @@ public YtdlpAdobeAuthTests() { try { - File.WriteAllText(_fullFakePath, ""); + File.WriteAllText(_fullFakePath, "fake yt-dlp executable"); } catch (IOException) { diff --git a/tests/Ytdlp.NET.Test/YtdlpAuthTests.cs b/tests/Ytdlp.NET.Test/YtdlpAuthTests.cs index e83f7e5..fdc76ad 100644 --- a/tests/Ytdlp.NET.Test/YtdlpAuthTests.cs +++ b/tests/Ytdlp.NET.Test/YtdlpAuthTests.cs @@ -17,7 +17,7 @@ public YtdlpAuthTests() { try { - File.WriteAllText(_fullFakePath, ""); + File.WriteAllText(_fullFakePath, "fake yt-dlp executable"); } catch (IOException) { diff --git a/tests/Ytdlp.NET.Test/YtdlpBuilderTests.cs b/tests/Ytdlp.NET.Test/YtdlpBuilderTests.cs index d75c3f5..e911b88 100644 --- a/tests/Ytdlp.NET.Test/YtdlpBuilderTests.cs +++ b/tests/Ytdlp.NET.Test/YtdlpBuilderTests.cs @@ -30,7 +30,7 @@ public YtdlpBuilderTests() { try { - File.WriteAllText(_fullFakePath, ""); + File.WriteAllText(_fullFakePath, "fake yt-dlp executable"); } catch (IOException) { diff --git a/tests/Ytdlp.NET.Test/YtdlpCancellationTests.cs b/tests/Ytdlp.NET.Test/YtdlpCancellationTests.cs index bab8fae..fb51a71 100644 --- a/tests/Ytdlp.NET.Test/YtdlpCancellationTests.cs +++ b/tests/Ytdlp.NET.Test/YtdlpCancellationTests.cs @@ -27,7 +27,7 @@ public YtdlpCancellationTests() { try { - File.WriteAllText(_fullFakePath, ""); + File.WriteAllText(_fullFakePath, "fake yt-dlp executable"); } catch (IOException) { diff --git a/tests/Ytdlp.NET.Test/YtdlpEventTests.cs b/tests/Ytdlp.NET.Test/YtdlpEventTests.cs index 9525b51..107e425 100644 --- a/tests/Ytdlp.NET.Test/YtdlpEventTests.cs +++ b/tests/Ytdlp.NET.Test/YtdlpEventTests.cs @@ -24,7 +24,7 @@ public YtdlpEventTests() { try { - File.WriteAllText(_fullFakePath, ""); + File.WriteAllText(_fullFakePath, "fake yt-dlp executable"); } catch (IOException) {