mirror of https://github.com/jetkvm/kvm.git
Write plugin database to tmp file first
This commit is contained in:
parent
0a772005dc
commit
00fdbafeb7
|
@ -38,9 +38,9 @@ func (d *PluginDatabase) Save() error {
|
|||
d.saveMutex.Lock()
|
||||
defer d.saveMutex.Unlock()
|
||||
|
||||
file, err := os.Create(databaseFile)
|
||||
file, err := os.Create(databaseFile + ".tmp")
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to create plugin database: %v", err)
|
||||
return fmt.Errorf("failed to create plugin database tmp: %v", err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
|
@ -50,5 +50,9 @@ func (d *PluginDatabase) Save() error {
|
|||
return fmt.Errorf("failed to encode plugin database: %v", err)
|
||||
}
|
||||
|
||||
if err := os.Rename(databaseFile+".tmp", databaseFile); err != nil {
|
||||
return fmt.Errorf("failed to move plugin database to active file: %v", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -576,7 +576,7 @@ function InstallPluginView({
|
|||
description={
|
||||
!manifest ?
|
||||
`Extracting plugin from ${filename}...` :
|
||||
`Do you want to install the plugin?`
|
||||
`Do you want to install this plugin?`
|
||||
}
|
||||
/>
|
||||
{manifest && (
|
||||
|
|
Loading…
Reference in New Issue