Compare commits

..

1 Commits

Author SHA1 Message Date
2381e522e7
WIP: feat: cancel git clone ops gracefully
Some checks failed
continuous-integration/drone/push Build is failing
See #528
2025-04-22 20:02:01 +02:00

View File

@ -32,6 +32,7 @@ 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) {
@ -73,9 +74,13 @@ 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 {