jsdelivr / globalping-cli

A simple CLI tool to run networking commands remotely from hundreds of globally distributed servers
Mozilla Public License 2.0
118 stars 14 forks source link

Re-use probes support - history #84

Closed radulucut closed 7 months ago

radulucut commented 8 months ago

Adds support for reusing probes as discussed in #79.

This also adds 2 new CI runners for tests (macOS-latest & windows-latest)

MartinKolarik commented 7 months ago

@radulucut there seems to be a problem when running this from Git Bash, which is a common setup on Windows. I always get the "no previous measurements found" message.

It works fine when running directly from Windows native command line or WSL. Do you have a Windows machine where you could test this to see where it's failing?

This might also be a good case for CI tests: run a test targeting cdn.jsdelivr.net in a real shell based on the platform, then a second test using from previous, and check that it ran successfully. On Linux/Mac it would test the default shells and on Windows the default + Git for Windows (can be installed via Winget).

radulucut commented 7 months ago

The parent pid is different on each run when running from git-bash. I assume it spawns a new process each time you run a command.

MartinKolarik commented 7 months ago

I see, any ideas for workarounds? Maybe if we can detect that specific shell we could go one level higher and get "parent parent id" instead?

MartinKolarik commented 7 months ago

I think this is related to the recent error handling change - can we avoid printing the usage instructions in this case?

image

jimaek commented 7 months ago

Am I doing something wrong? It doesn't seem to work. I'm running it on Ubuntu 22.04.3 LTS

root@ansible2:~/globalping-cli# go run main.go ping google.com from germany
> EU, DE, Falkenstein, ASN:24940, Hetzner Online GmbH
PING  (142.250.186.174) 56(84) bytes of data.
64 bytes from fra24s08-in-f14.1e100.net (142.250.186.174): icmp_seq=1 ttl=116 time=5.32 ms
64 bytes from fra24s08-in-f14.1e100.net (142.250.186.174): icmp_seq=2 ttl=116 time=5.10 ms
64 bytes from fra24s08-in-f14.1e100.net (142.250.186.174): icmp_seq=3 ttl=116 time=5.22 ms

---  ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 914ms
rtt min/avg/max/mdev = 5.096/5.211/5.319/0.091 ms
root@ansible2:~/globalping-cli# go run main.go ping google.com from previous
Error: no previous measurements found
exit status 1
MartinKolarik commented 7 months ago

Don't use go run, build it and run the binary directly.