Archived
Locking around osutil.Rename and some descriptive text
This commit is contained in:
1 parent
7fd2e4d2db
commit
4ddd87e773
2 files changed
+14
-11
No files matched your search
+1
-11
@@ -630,13 +630,6 @@ func (m *Model) SetIgnores(repo string, content []string) error {
|
||||
fmt.Fprintln(writer, line)
|
||||
}
|
||||
|
||||
err = writer.Flush()
|
||||
if err != nil {
|
||||
l.Warnln("Saving .stignore:", err)
|
||||
fd.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
err = fd.Close()
|
||||
if err != nil {
|
||||
l.Warnln("Saving .stignore:", err)
|
||||
@@ -644,10 +637,7 @@ func (m *Model) SetIgnores(repo string, content []string) error {
|
||||
}
|
||||
|
||||
file := filepath.Join(cfg.Directory, ".stignore")
|
||||
m.rmut.Lock()
|
||||
os.Remove(file)
|
||||
err = osutil.Rename(fd.Name(), file)
|
||||
m.rmut.Unlock()
|
||||
err = osutil.Rename(tmpFileName, file)
|
||||
if err != nil {
|
||||
l.Warnln("Saving .stignore:", err)
|
||||
return err
|
||||
|
||||
Reference in new issue
Block a user