miekg/gitopper

^c kill, but doesn't exit?

miekg opened this issue · 10 comments

miekg commented
2022/11/26 15:58:12 [INFO ] Reading public key "keys/miek_id_ed25519_gitopper.pub"
2022/11/26 15:58:12 [INFO ] Launched servers on port :2222 (ssh) and :9222 (metrics) for machines: [limos localhost], 1 public keys loaded
2022/11/26 15:58:12 [INFO ] Machine "localhost" "https://github.com/miekg/gitopper-config"
2022/11/26 15:58:12 [INFO ] Machine "localhost", repository in "/tmp/prometheus" with "f6ba45cca30e31b2f0b2e32ca22771cd6f1171ed"
2022/11/26 15:58:12 [INFO ] Directory "/etc/prometheus" is already mounted
2022/11/26 15:58:12 [INFO ] Launched tracking routine for "localhost"/"prometheus"
2022/11/26 15:58:12 [INFO ] running [systemctl show --property=ExecMainStartTimestamp prometheus]
WG wait
^CSIG (0x9cca90,0xc96170)
done
RETURN NIL
^C

And then it hangs... Note the RETURN NIL is right before return nil in run(). Then I have a println :

	flag.Parse()
	err := run(&exec)
	println("DOING THE SWITCH ON ERROR")

which DOES NOT GET PRINTED?

huh?

miekg commented

like WAT?

2022/11/26 16:02:44 [INFO ] running [systemctl show --property=ExecMainStartTimestamp prometheus]
^CSIG (0x9cca90,0xc96170)
done
RETURN NIL
^C^C^C^Z
zsh: suspended  sudo ./gitopper -c config.toml -h localhost
[1] % kill -9 %1                                               
[1]  + killed     sudo ./gitopper -c config.toml -h localhost  
miekg commented

and now ^C does work. There is a race somewhere here...

miekg commented

ah, it's the defers that block the return from exec - ok at least my println now make sense.

yeah, def. the context somewhere. looking

miekg commented
miekg commented

Gotta go in a minute, but if I just comment that out, nothing changes and ^C always (tried 3 times....) works.

which isn't correct, because it's the only Wait for the controllerWG, but might be hint, prolly the SSH server that's being annoying here.

miekg commented

fix with 29b3e8d

miekg commented

it works, but only in the happy case. If some git checkout fails, it will still hang after a ^C