mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2025-03-05 20:49:04 -08:00
fix(install): release file lock before return
This commit is contained in:
parent
b8180b197c
commit
d9c2fbb784
|
@ -32,16 +32,14 @@ func install(tag string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
defer fp.Close()
|
|
||||||
|
|
||||||
_, err = io.Copy(fp, bytes.NewReader(data))
|
_, err = io.Copy(fp, bytes.NewReader(data))
|
||||||
|
// windows will have a lock when we do not close the file
|
||||||
|
fp.Close()
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// windows will have a lock when we do not close the file
|
|
||||||
fp.Close()
|
|
||||||
|
|
||||||
oldPath := filepath.Join(targetDir, fmt.Sprintf(".%s.old", fileName))
|
oldPath := filepath.Join(targetDir, fmt.Sprintf(".%s.old", fileName))
|
||||||
|
|
||||||
_ = os.Remove(oldPath)
|
_ = os.Remove(oldPath)
|
||||||
|
|
Loading…
Reference in a new issue