mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-16 14:40:12 +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
|
|
@ -520,11 +520,6 @@ const initKernel = (workspace, port, lang) => {
|
|||
"⚠️ 创建配置目录失败 Failed to create config directory",
|
||||
"<div>思源需要在用户家目录下创建配置文件夹(~/.config/siyuan),请确保该路径具有写入权限。</div><div>SiYuan needs to create a configuration folder (~/.config/siyuan) in the user\'s home directory. Please make sure that the path has write permissions.</div>");
|
||||
break;
|
||||
case 23:
|
||||
showErrorWindow(
|
||||
"⚠️ 无法读写块树文件 Failed to access blocktree file",
|
||||
"<div>块树文件正在被其他程序锁定或者已经损坏,请删除 工作空间/temp/ 文件夹后重启</div><div>The block tree file is being locked by another program or is corrupted, please delete the workspace/temp/ folder and restart.</div>");
|
||||
break;
|
||||
case 24: // 工作空间已被锁定,尝试切换到第一个打开的工作空间
|
||||
if (workspaces && 0 < workspaces.length) {
|
||||
showWindow(workspaces[0].browserWindow);
|
||||
|
|
@ -541,8 +536,8 @@ const initKernel = (workspace, port, lang) => {
|
|||
break;
|
||||
case 26:
|
||||
showErrorWindow(
|
||||
"⚠️ 文件系统不一致 File system inconsistent",
|
||||
"<div>请勿使用第三方同步盘进行数据同步,否则数据会被损坏(iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等)</div><div>Do not use a third-party sync disk for data sync, otherwise the data will be damaged (OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)</div>");
|
||||
"⚠️ 文件系统读写错误 File system access error",
|
||||
"<div>请检查文件系统权限,并确保没有其他程序正在读写文件<br>请勿使用第三方同步盘进行数据同步,否则数据会被损坏(iCloud/OneDrive/Dropbox/Google Drive/坚果云/百度网盘/腾讯微云等)</div><div>Please check file system permissions and make sure no other programs are reading or writing to the file<br>Do not use a third-party sync disk for data sync, otherwise the data will be damaged (OneDrive/Dropbox/Google Drive/Nutstore/Baidu Netdisk/Tencent Weiyun, etc.)</div>");
|
||||
break;
|
||||
case 0:
|
||||
case 1: // Fatal error
|
||||
|
|
@ -554,6 +549,7 @@ const initKernel = (workspace, port, lang) => {
|
|||
<div>SiYuan Kernel exited for unknown reasons [code=${code}], please try to reboot your operating system and then start SiYuan again. If occurs this problem still, please check your anti-virus software whether kill the SiYuan Kernel.</div>`);
|
||||
break;
|
||||
}
|
||||
|
||||
exitApp("port", kernelPort);
|
||||
bootWindow.destroy();
|
||||
resolve(false);
|
||||
|
|
|
|||
|
|
@ -45,9 +45,9 @@ require (
|
|||
github.com/siyuan-note/dejavu v0.0.0-20230315034343-e9513a7e1999
|
||||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75
|
||||
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b
|
||||
github.com/siyuan-note/filelock v0.0.0-20230318155428-4b54cef95279
|
||||
github.com/siyuan-note/filelock v0.0.0-20230319015503-9ac4a0ee675b
|
||||
github.com/siyuan-note/httpclient v0.0.0-20230309131049-f703795de6bc
|
||||
github.com/siyuan-note/logging v0.0.0-20230318155021-66a29c2075ee
|
||||
github.com/siyuan-note/logging v0.0.0-20230319012246-6224f958f554
|
||||
github.com/siyuan-note/riff v0.0.0-20230224144841-cfbe0748ddb7
|
||||
github.com/steambap/captcha v1.4.1
|
||||
github.com/studio-b12/gowebdav v0.0.0-20230203202212-3282f94193f2
|
||||
|
|
|
|||
|
|
@ -283,12 +283,12 @@ github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75 h1:Bi7/7f29
|
|||
github.com/siyuan-note/encryption v0.0.0-20220713091850-5ecd92177b75/go.mod h1:H8fyqqAbp9XreANjeSbc72zEdFfKTXYN34tc1TjZwtw=
|
||||
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b h1:828lTUW2C0uNiolODqoACu7J8sDUzswD4Xo04mUombg=
|
||||
github.com/siyuan-note/eventbus v0.0.0-20230216103454-41885eac6c2b/go.mod h1:Sqo4FYX5lAXu7gWkbEdJF0e6P57tNNVV4WDKYDctokI=
|
||||
github.com/siyuan-note/filelock v0.0.0-20230318155428-4b54cef95279 h1:sEP5/DN/Gd3AE51wxujJQyH2BYWhgQ4PMCJVG/92VJs=
|
||||
github.com/siyuan-note/filelock v0.0.0-20230318155428-4b54cef95279/go.mod h1:IBWcCZc4ihicGp4FJgytb8uE2/NN9XNvyv8Pn3lmmo8=
|
||||
github.com/siyuan-note/filelock v0.0.0-20230319015503-9ac4a0ee675b h1:nK+77PDzDEyLBAdX4e3SKWQp6P1uDP0Td8j72ir1hT0=
|
||||
github.com/siyuan-note/filelock v0.0.0-20230319015503-9ac4a0ee675b/go.mod h1:sOq/g1jqdnkR/kAqOsTZFSr10Env4AN2nKOhZn62vQ8=
|
||||
github.com/siyuan-note/httpclient v0.0.0-20230309131049-f703795de6bc h1:MX2cPWpn7Hfd3FmpwLjGdPIjF84AFUS9f/mcPJc/4w4=
|
||||
github.com/siyuan-note/httpclient v0.0.0-20230309131049-f703795de6bc/go.mod h1:WDO42mUVRnkk8M4AhZ4oakZ5jnghulP0c8NFCrrFWG4=
|
||||
github.com/siyuan-note/logging v0.0.0-20230318155021-66a29c2075ee h1:KwU0r4UjabPFjVsXhYmNfm1QRdcj1ps5o1XxsTIJ924=
|
||||
github.com/siyuan-note/logging v0.0.0-20230318155021-66a29c2075ee/go.mod h1:6mRFtAAvYPn3cDzqvyv+t8BVPGqpONDMMb5ywOhY1D4=
|
||||
github.com/siyuan-note/logging v0.0.0-20230319012246-6224f958f554 h1:uaLbecIT6G7jFQUscXSzIxi/hDVSfzZccMCl8Lzqqn0=
|
||||
github.com/siyuan-note/logging v0.0.0-20230319012246-6224f958f554/go.mod h1:6mRFtAAvYPn3cDzqvyv+t8BVPGqpONDMMb5ywOhY1D4=
|
||||
github.com/siyuan-note/riff v0.0.0-20230224144841-cfbe0748ddb7 h1:Kr8hhMhr6v+U24TMDCP5WdP4dWrXm5maar+TycTZs9I=
|
||||
github.com/siyuan-note/riff v0.0.0-20230224144841-cfbe0748ddb7/go.mod h1:XJtLlKCr8cZE+lzykM4edHHih92M9M50UNw/nDLYRN8=
|
||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ func ReportFileSysFatalError(err error) {
|
|||
output = strings.Join(lines[5:], "\n")
|
||||
}
|
||||
logging.LogErrorf("check file system status failed: %s, %s", err, output)
|
||||
os.Exit(logging.ExitCodeFileSysInconsistent)
|
||||
os.Exit(logging.ExitCodeFileSysErr)
|
||||
}
|
||||
|
||||
func CheckFileSysStatus() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue