netbirdio / netbird

Connect your devices into a secure WireGuard®-based overlay network with SSO, MFA and granular access controls.
https://netbird.io
BSD 3-Clause "New" or "Revised" License
10.04k stars 441 forks source link

Fix checkpid on windows #2031

Closed hurricanehrndz closed 1 month ago

hurricanehrndz commented 2 months ago

Describe your changes

syscall.signal 0 does not work on windows as it is not implemented

Issue ticket number and link

Checklist

hurricanehrndz commented 2 months ago

Sounds good, I will updates it accordingly

Get Outlook for iOShttps://aka.ms/o0ukef


From: Viktor Liu @.> Sent: Thursday, May 23, 2024 3:43:25 PM To: netbirdio/netbird @.> Cc: Carlos Hernandez @.>; Mention @.> Subject: Re: [netbirdio/netbird] Fix checkpid on windows (PR #2031)

@lixmal commented on this pull request.


In client/ui/client_ui.gohttps://github.com/netbirdio/netbird/pull/2031#discussion_r1612344453:

  • cmd := exec.Command("tasklist", "/FI", fmt.Sprintf("PID eq %d", pid))
  • // Get the output
  • output, err := cmd.Output()
  • if err != nil {
  • return false
  • }
  • // Parse the output
  • scanner := bufio.NewScanner(strings.NewReader(string(output)))
  • for scanner.Scan() {
  • line := scanner.Text()
  • if strings.Contains(line, fmt.Sprintf("%d", pid)) {
  • return true
  • }
  • }

Right, but if there's an issue that would at least give us a hint when debugging the application from CLI

— Reply to this email directly, view it on GitHubhttps://github.com/netbirdio/netbird/pull/2031#discussion_r1612344453, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABMJBTMGPUWD5LZPKZ5GWRDZDZPH3AVCNFSM6AAAAABIDTY5BGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDANZVGE2DEMRXG4. You are receiving this because you were mentioned.Message ID: @.***>

hurricanehrndz commented 1 month ago

Although this patch somewhat works, I am not entirely happy, since a miss click will run multiple apps. I will close this for now, and reopen and when I have a better solution