Skip to content

Commit 5f56226

Browse files
committed
Merge branch 'v2.5' into master
2 parents 1a7098e + b3f5d96 commit 5f56226

File tree

2 files changed

+118
-1
lines changed

2 files changed

+118
-1
lines changed

azure-pipelines/release.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
trigger: none # We only want to trigger manually or based on resources
2+
pr: none
3+
4+
resources:
5+
pipelines:
6+
- pipeline: CI
7+
source: Nerdbank.Streams
8+
trigger:
9+
tags:
10+
- auto-release
11+
12+
stages:
13+
- stage: GitHubRelease
14+
displayName: GitHub Release
15+
jobs:
16+
- deployment: create
17+
pool:
18+
vmImage: ubuntu-latest
19+
environment: No-Approval
20+
strategy:
21+
runOnce:
22+
deploy:
23+
steps:
24+
- download: none
25+
- powershell: |
26+
Write-Host "##vso[build.updatebuildnumber]$(resources.pipeline.CI.runName)"
27+
displayName: Set pipeline name
28+
- task: GitHubRelease@1
29+
displayName: GitHub release (create)
30+
inputs:
31+
gitHubConnection: GitHub AArnott
32+
repositoryName: $(Build.Repository.Name)
33+
target: $(resources.pipeline.CI.sourceCommit)
34+
tagSource: userSpecifiedTag
35+
tag: v$(resources.pipeline.CI.runName)
36+
title: v$(resources.pipeline.CI.runName)
37+
isDraft: true
38+
changeLogCompareToRelease: lastNonDraftRelease
39+
changeLogType: issueBased
40+
changeLogLabels: |
41+
[
42+
{ "label" : "bug", "displayName" : "Fixes", "state" : "closed" },
43+
{ "label" : "enhancement", "displayName": "Enhancements", "state" : "closed" }
44+
]
45+
46+
- stage: nuget_org
47+
displayName: nuget.org
48+
dependsOn: GitHubRelease
49+
jobs:
50+
- deployment: push
51+
pool:
52+
vmImage: ubuntu-latest
53+
environment: No-Approval
54+
strategy:
55+
runOnce:
56+
deploy:
57+
steps:
58+
- download: CI
59+
artifact: deployables-Windows
60+
displayName: Download deployables-Windows artifact
61+
patterns: 'deployables-Windows/NuGet/*'
62+
- task: NuGetToolInstaller@1
63+
displayName: Use NuGet 5.x
64+
inputs:
65+
versionSpec: 5.x
66+
- task: NuGetCommand@2
67+
displayName: NuGet push
68+
inputs:
69+
command: push
70+
packagesToPush: $(Pipeline.Workspace)/CI/deployables-Windows/NuGet/*.nupkg
71+
nuGetFeedType: external
72+
publishFeedCredentials: nuget.org
73+
74+
- stage: npmjs_org
75+
displayName: npmjs.org
76+
dependsOn: GitHubRelease
77+
jobs:
78+
- deployment: push
79+
pool:
80+
vmImage: ubuntu-latest
81+
environment: No-Approval
82+
strategy:
83+
runOnce:
84+
deploy:
85+
steps:
86+
- download: CI
87+
artifact: deployables-Windows
88+
displayName: Download deployables-Windows artifact
89+
patterns: 'deployables-Windows/npm/*'
90+
- powershell: |
91+
$tgz = (Get-ChildItem "$(Pipeline.Workspace)/CI/deployables-Windows/npm/*.tgz")[0].FullName
92+
93+
npm init -y
94+
npm install $tgz
95+
workingDirectory: $(Agent.TempDirectory)
96+
displayName: Prepare to publish TGZ
97+
- task: Npm@1
98+
displayName: npm publish
99+
inputs:
100+
command: publish
101+
workingDir: $(Agent.TempDirectory)/node_modules/nerdbank-streams
102+
verbose: false
103+
publishEndpoint: npmjs.org

src/Nerdbank.Streams/PipeExtensions.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,21 @@ private static PipeReader UsePipeReader(this Stream stream, int sizeHint = 0, Pi
471471
// we can return a decorated PipeReader that calls us from its Complete method directly.
472472
var combinedTokenSource = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken);
473473
#pragma warning disable CS0618 // Type or member is obsolete
474-
pipe.Writer.OnReaderCompleted((ex, state) => ((CancellationTokenSource)state).Cancel(), combinedTokenSource);
474+
pipe.Writer.OnReaderCompleted(
475+
(ex, state) =>
476+
{
477+
try
478+
{
479+
((CancellationTokenSource)state).Cancel();
480+
}
481+
catch (AggregateException cancelException)
482+
{
483+
// .NET Core may throw this when canceling async I/O (https://github.com/dotnet/runtime/issues/39902).
484+
// Just swallow it. We've canceled what we intended to.
485+
cancelException.Handle(x => x is ObjectDisposedException);
486+
}
487+
},
488+
combinedTokenSource);
475489

476490
// When this argument is provided, it provides a means to ensure we don't hang while reading from an I/O pipe
477491
// that doesn't respect the CancellationToken. Disposing a Stream while reading is a means to terminate the ReadAsync operation.

0 commit comments

Comments
 (0)