Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:bug: 内核参数 `--resident` 和 `--readonly` 参数解析问题 Fix https://github.com/siyuan-note/siyuan/issues/6345

Liang Dingffc35d8573b4
diff --git a/app/electron/main.js b/app/electron/main.js
index a3fc75b091..e095d36c1e 100644
--- a/app/electron/main.js
+++ b/app/electron/main.js
@@ -538,18 +538,18 @@ const initKernel = (initData) => {
return
}
- let cmd = `ui version [${appVer}], booting kernel [${kernelPath} --wd=${appDir}]`
const cmds = ['--wd', appDir]
cmds.push('--resident', 'false')
if (isDevEnv) {
cmds.push('--mode', 'dev')
+ cmds.push('--port', '6806')
}
if (initData) {
const initDatas = initData.split('-')
cmds.push('--workspace', initDatas[0])
cmds.push('--lang', initDatas[1])
- cmd = `ui version [${appVer}], booting kernel [${kernelPath} --wd=${appDir} --workspace=${initDatas[0]} --lang=${initDatas[1]}]`
}
+ let cmd = `ui version [${appVer}], booting kernel [${kernelPath} ${cmds.join(' ')}]`
writeLog(cmd)
const cp = require('child_process')
const kernelProcess = cp.spawn(kernelPath,
diff --git a/kernel/util/working.go b/kernel/util/working.go
index 9f188a9b89..220eb16741 100644
--- a/kernel/util/working.go
+++ b/kernel/util/working.go
@@ -61,8 +61,8 @@ func Boot() {
servePath := flag.String("servePath", "", "obsoleted https://github.com/siyuan-note/siyuan/issues/4647")
_ = servePath
port := flag.String("port", "0", "port of the HTTP server")
- resident := flag.Bool("resident", true, "resident memory even if no active session")
- readOnly := flag.Bool("readonly", false, "read-only mode")
+ resident := flag.String("resident", "true", "resident memory even if no active session")
+ readOnly := flag.String("readonly", "false", "read-only mode")
accessAuthCode := flag.String("accessAuthCode", "", "access auth code")
ssl := flag.Bool("ssl", false, "for https and wss")
lang := flag.String("lang", "", "zh_CN/zh_CHT/en_US/fr_FR/es_ES")
@@ -76,12 +76,12 @@ func Boot() {
Lang = *lang
}
Mode = *mode
- Resident = *resident
+ Resident, _ = strconv.ParseBool(*resident)
ServerPort = *port
if isRunningInDockerContainer() || "dev" == Mode {
ServerPort = "6806"
}
- ReadOnly = *readOnly
+ ReadOnly, _ = strconv.ParseBool(*readOnly)
AccessAuthCode = *accessAuthCode
Container = ContainerStd
if isRunningInDockerContainer() {