Skip to content

fix(downloadTool): drop abort to fix downloads #234

@riezebosch

Description

@riezebosch

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/azure-pipelines-tool-lib/tool.js b/node_modules/azure-pipelines-tool-lib/tool.js
index 48afe82..911bc89 100644
--- a/node_modules/azure-pipelines-tool-lib/tool.js
+++ b/node_modules/azure-pipelines-tool-lib/tool.js
@@ -234,11 +234,6 @@ function downloadTool(url, fileName, handlers, additionalHeaders) {
                             .on('error', (err) => {
                             file.end();
                             reject(err);
-                        })
-                            .on('aborted', () => {
-                            // this block is for Node10 compatibility since it doesn't emit 'error' event after 'aborted' one
-                            file.end();
-                            reject(new Error('Aborted'));
                         })
                             .pipe(file);
                     }

This issue body was partially generated by patch-package.

I was working on updating the dependency of my packerTool task and found out that for every test run the download would fail with the dreaded Aborted error. By patching your package it was consequently solved.

The event is also already deprecated for a while: https://nodejs.org/api/http.html#event-abort

Pretty sure it will fix these issues: microsoft/azure-pipelines-tasks#18280

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions