Compare commits
1 Commits
706d539dc4
...
2381e522e7
Author | SHA1 | Date | |
---|---|---|---|
2381e522e7 |
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user