Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tsp init hanging when done due to unclosed connection #3185

Merged
merged 4 commits into from
Apr 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
# Change versionKind to one of: internal, fix, dependencies, feature, deprecation, breaking
changeKind: fix
packages:
- "@typespec/compiler"
---

Fix tsp init hanging when done due to unclosed connection
1 change: 1 addition & 0 deletions packages/compiler/src/core/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export function fetch(uri: string): Promise<FetchResponse> {
protocol
.get(url, (res) => {
if ((res.statusCode === 301 || res.statusCode === 302) && res.headers.location) {
res.destroy(); // destroy the response otherwise it gets stuck waiting for data.
return request(res.headers.location, resolve, reject);
}
let data = "";
Expand Down
Loading