mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-24 02:20:13 +01:00
🎨 文件系统读取或写入失败时退出内核 https://github.com/siyuan-note/siyuan/issues/7707
This commit is contained in:
parent
5f6d1eac9a
commit
c8cef8f455
5 changed files with 16 additions and 20 deletions
|
|
@ -325,7 +325,7 @@ func InitBlockTree(force bool) {
|
|||
entries, err := os.ReadDir(util.BlockTreePath)
|
||||
if nil != err {
|
||||
logging.LogErrorf("read block tree dir failed: %s", err)
|
||||
os.Exit(logging.ExitCodeBlockTreeErr)
|
||||
os.Exit(logging.ExitCodeFileSysErr)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -342,7 +342,7 @@ func InitBlockTree(force bool) {
|
|||
fh, err = os.OpenFile(p, os.O_RDWR, 0644)
|
||||
if nil != err {
|
||||
logging.LogErrorf("open block tree file failed: %s", err)
|
||||
os.Exit(logging.ExitCodeBlockTreeErr)
|
||||
os.Exit(logging.ExitCodeFileSysErr)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ func InitBlockTree(force bool) {
|
|||
fh.Close()
|
||||
if nil != err {
|
||||
logging.LogErrorf("read block tree failed: %s", err)
|
||||
os.Exit(logging.ExitCodeBlockTreeErr)
|
||||
os.Exit(logging.ExitCodeFileSysErr)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -361,7 +361,7 @@ func InitBlockTree(force bool) {
|
|||
if err = os.RemoveAll(util.BlockTreePath); nil != err {
|
||||
logging.LogErrorf("removed corrupted block tree failed: %s", err)
|
||||
}
|
||||
os.Exit(logging.ExitCodeBlockTreeErr)
|
||||
os.Exit(logging.ExitCodeFileSysErr)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -410,7 +410,7 @@ func SaveBlockTree(force bool) {
|
|||
data, err := msgpack.Marshal(slice.data)
|
||||
if nil != err {
|
||||
logging.LogErrorf("marshal block tree failed: %s", err)
|
||||
os.Exit(logging.ExitCodeBlockTreeErr)
|
||||
os.Exit(logging.ExitCodeFileSysErr)
|
||||
return false
|
||||
}
|
||||
slice.m.Unlock()
|
||||
|
|
@ -418,7 +418,7 @@ func SaveBlockTree(force bool) {
|
|||
p := filepath.Join(util.BlockTreePath, key.(string)) + ".msgpack"
|
||||
if err = gulu.File.WriteFileSafer(p, data, 0644); nil != err {
|
||||
logging.LogErrorf("write block tree failed: %s", err)
|
||||
os.Exit(logging.ExitCodeBlockTreeErr)
|
||||
os.Exit(logging.ExitCodeFileSysErr)
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue