Compare commits

..

1 Commits

Author SHA1 Message Date
706d539dc4
WIP: feat: cancel git clone ops gracefully
Some checks reported errors
continuous-integration/drone/push Build was killed
See #528
2025-04-22 18:43:48 +02:00

View File

@ -32,7 +32,6 @@ func Clone(dir, url string) error {
defer signal.Stop(sigIntCh)
errCh := make(chan error)
waitCh := make(chan struct{})
go func() {
if _, err := os.Stat(dir); os.IsNotExist(err) {
@ -74,13 +73,9 @@ func Clone(dir, url string) error {
} else {
log.Debugf("git clone: %s already exists", dir)
}
close(waitCh)
}()
select {
case <-waitCh:
return nil
case <-sigIntCh:
fmt.Println() // NOTE(d1): newline after ^C
if err := os.RemoveAll(dir); err != nil {