Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
Alderaan
pan-light
提交
de64065f
P
pan-light
项目概览
Alderaan
/
pan-light
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
pan-light
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
de64065f
编写于
6月 28, 2019
作者:
P
peterq
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix: windows 进程重启问题
上级
1a4b035c
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
48 addition
and
7 deletion
+48
-7
pc/dep/dep.go
pc/dep/dep.go
+11
-0
pc/functions/base.go
pc/functions/base.go
+3
-6
pc/pan-light-pc.go
pc/pan-light-pc.go
+34
-1
未找到文件。
pc/dep/dep.go
浏览文件 @
de64065f
package
dep
import
(
"io/ioutil"
"log"
"os"
"runtime"
"runtime/debug"
)
...
...
@@ -35,6 +38,14 @@ func DoClose() {
closeCb
=
nil
}
func
Reboot
()
{
if
runtime
.
GOOS
==
"windows"
{
ioutil
.
WriteFile
(
DataPath
(
"reboot"
),
[]
byte
(
"true"
),
0664
)
}
DoClose
()
os
.
Exit
(
2
)
}
var
NotifyQml
=
func
(
event
string
,
data
map
[
string
]
interface
{})
{
log
.
Println
(
"not ready"
)
}
pc/functions/base.go
浏览文件 @
de64065f
...
...
@@ -35,8 +35,7 @@ var baseSyncRoutes = map[string]syncHandler{
},
// 重启
"reboot"
:
func
(
p
map
[
string
]
interface
{})
(
result
interface
{})
{
dep
.
DoClose
()
os
.
Exit
(
2
)
dep
.
Reboot
()
return
},
// 退出
...
...
@@ -57,8 +56,7 @@ var baseSyncRoutes = map[string]syncHandler{
storage
.
UserState
.
Logout
=
true
}
storage
.
Global
.
CurrentUser
=
"default"
dep
.
DoClose
()
os
.
Exit
(
2
)
dep
.
Reboot
()
return
},
// 账号列表
...
...
@@ -75,8 +73,7 @@ var baseSyncRoutes = map[string]syncHandler{
// 切换账号
"account.change"
:
func
(
p
map
[
string
]
interface
{})
(
result
interface
{})
{
storage
.
Global
.
CurrentUser
=
p
[
"username"
]
.
(
string
)
dep
.
DoClose
()
os
.
Exit
(
2
)
dep
.
Reboot
()
return
},
}
...
...
pc/pan-light-pc.go
浏览文件 @
de64065f
...
...
@@ -5,9 +5,11 @@ package main
import
(
"github.com/peterq/pan-light/pc/dep"
"github.com/peterq/pan-light/pc/gui"
"io/ioutil"
"log"
"os"
"os/exec"
"runtime"
"syscall"
)
...
...
@@ -29,6 +31,12 @@ func main() {
const
startCmd
=
"pan_light_start"
func
master
()
{
if
runtime
.
GOOS
==
"windows"
{
windosMaster
()
return
}
log
.
Println
(
"master process"
)
START_PAN
:
c
:=
exec
.
Command
(
os
.
Args
[
0
],
os
.
Args
[
1
:
]
...
)
...
...
@@ -43,7 +51,28 @@ START_PAN:
code
:=
status
.
ExitStatus
()
if
code
==
2
{
goto
START_PAN
}
else
if
code
==
3221225477
{
}
}
}
}
log
.
Fatal
(
err
)
}
func
windosMaster
()
{
log
.
Println
(
"master process"
)
START_PAN
:
os
.
Remove
(
dep
.
DataPath
(
"reboot"
))
c
:=
exec
.
Command
(
os
.
Args
[
0
],
os
.
Args
[
1
:
]
...
)
c
.
Args
[
0
]
=
startCmd
c
.
Stderr
=
os
.
Stderr
c
.
Stdout
=
os
.
Stdout
c
.
Stdin
=
os
.
Stdin
err
:=
c
.
Run
()
if
err
!=
nil
{
if
exiterr
,
ok
:=
err
.
(
*
exec
.
ExitError
);
ok
{
if
status
,
ok
:=
exiterr
.
Sys
()
.
(
syscall
.
WaitStatus
);
ok
{
code
:=
status
.
ExitStatus
()
if
code
==
3221225477
{
if
os
.
Getenv
(
"pan_light_render_exception_fix"
)
!=
"true"
{
os
.
Setenv
(
"pan_light_render_exception_fix"
,
"true"
)
goto
START_PAN
...
...
@@ -52,5 +81,9 @@ START_PAN:
}
}
}
bin
,
_
:=
ioutil
.
ReadFile
(
dep
.
DataPath
(
"reboot"
))
if
string
(
bin
)
==
"true"
{
goto
START_PAN
}
log
.
Fatal
(
err
)
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录