Skip to content

processhelp.pm: improve taskkill calls (Windows) - #14959

Closed
vszakats wants to merge 4 commits into
curl:masterfrom
vszakats:w-taskkill
Closed

processhelp.pm: improve taskkill calls (Windows)#14959
vszakats wants to merge 4 commits into
curl:masterfrom
vszakats:w-taskkill

Conversation

@vszakats

@vszakats vszakats commented Sep 18, 2024

Copy link
Copy Markdown
Member
  • drop tasklist call before taskkill.
    taskkill offers two ways to kill a pid:

    1. -pid <pid>
      If <pid> is missing it returns 128 and outputs:
      ERROR: The process "<pid>" not found.
      
    2. -fi "PID eq <pid>"
      If <pid> is missing, it returns 0 and outputs:
      INFO: No tasks running with the specified criteria.
      

    The curl runner script doesn't check the result of the call and both
    stdout and stderr are redirected to NUL.
    Meaning the tasklist calls pre-verifying if the PID exists are not
    necessary and we can drop them to put less strain on the runner
    environment.

  • log a taskkill call missed earlier.
    Follow-up to e53523f CI: move Azure jobs to GHA, fix fallouts, sshserver, runtests tweaks #14859

  • streamline taskkill calls by using the -pid option
    (was -fi <filter-expression>).

  • make taskkill in pidterm() use -t to kill the process tree.

Ref: #11009


w/o whitespace: https://github.com/curl/curl/pull/14959/files?w=1

taskkill has two ways of killing a task:

1. `-pid <pid>`
   If `<pid>` is missing it returns 128 and outputs:
   ```
   ERROR: The process "<pid>" not found.
   ```

2. `-fi "PID eq <pid>"`
   If `<pid>` is missing, it returns 0 and outputs:
   ```
   INFO: No tasks running with the specified criteria.
   ```

The curl runner script doesn't check the result of the call and
both stdout and stderr are redirected to NUL.
@mback2k

mback2k commented Sep 18, 2024

Copy link
Copy Markdown
Member

Sounds like a good plan, but haven't checked the code changes!

@vszakats vszakats changed the title processhelp.pm: improve taskkill calls processhelp.pm: improve taskkill calls (Windows) Sep 18, 2024
@vszakats vszakats closed this in c997f3e Sep 19, 2024
@vszakats
vszakats deleted the w-taskkill branch September 19, 2024 10:44
pps83 pushed a commit to pps83/curl that referenced this pull request Apr 26, 2025
- drop `tasklist` call before `taskkill`.
  `taskkill` offers two ways to kill a `pid`:
  1. `-pid <pid>`
     If `<pid>` is missing it returns 128 and outputs:
     ```
     ERROR: The process "<pid>" not found.
     ```
  2. `-fi "PID eq <pid>"`
     If `<pid>` is missing, it returns 0 and outputs:
     ```
     INFO: No tasks running with the specified criteria.
     ```
  The curl runner script doesn't check the result of the call and both
  stdout and stderr are redirected to NUL.
  Meaning the `tasklist` calls pre-verifying if the PID exists are not
  necessary and we can drop them to put less strain on the runner
  environment.

- log a `taskkill` call missed earlier.
  Follow-up to e53523f curl#14859

- streamline `taskkill` calls by using the `-pid` option
  (was `-fi <filter-expression>`).

- make `taskkill` in `pidterm()` use `-t` to kill the process tree.

Ref: curl#11009
Closes curl#14959
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants