^c kill, but doesn't exit?
miekg opened this issue · 10 comments
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?
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
and now ^C does work. There is a race somewhere here...
ah, it's the defer
s that block the return from exec
- ok at least my println
now make sense.
yeah, def. the context somewhere. looking
it's this one: https://github.com/miekg/gitopper/blob/main/main.go#L220 (controllerWG.Wait())
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.
it works, but only in the happy case. If some git checkout fails, it will still hang after a ^C