Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
chain33-pai
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
szh
chain33-pai
Commits
6047ecc2
Commit
6047ecc2
authored
Dec 26, 2019
by
szh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加绝对路径删除文件
parent
6581be90
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
+11
-6
node.go
routers/api/v1/node.go
+11
-6
No files found.
routers/api/v1/node.go
View file @
6047ecc2
...
@@ -70,6 +70,12 @@ func UpdateNode(c *gin.Context){
...
@@ -70,6 +70,12 @@ func UpdateNode(c *gin.Context){
return
return
}
}
absPath
:=
app
.
GetAbsPath
(
setting
.
BityuanSetting
.
Name
)
absPath
:=
app
.
GetAbsPath
(
setting
.
BityuanSetting
.
Name
)
pwd
,
err
:=
os
.
Getwd
()
if
err
!=
nil
{
appG
.
Response
(
http
.
StatusOK
,
e
.
ERROR
,
"get pwd err"
)
return
}
pwd
=
pwd
+
"/"
app
.
BityuanFlag
=
true
app
.
BityuanFlag
=
true
app
.
UpdateInfo
.
Flag
=
false
app
.
UpdateInfo
.
Flag
=
false
setting
.
FreshVersion
()
setting
.
FreshVersion
()
...
@@ -161,9 +167,9 @@ func UpdateNode(c *gin.Context){
...
@@ -161,9 +167,9 @@ func UpdateNode(c *gin.Context){
//替换原执行文件
//替换原执行文件
log
.
Println
(
setting
.
BityuanSetting
.
Name
+
"_"
+
latestVersion
)
log
.
Println
(
setting
.
BityuanSetting
.
Name
+
"_"
+
latestVersion
)
log
.
Println
(
absPath
)
log
.
Println
(
absPath
)
mv
:=
exec
.
Command
(
"mv"
,
setting
.
BityuanSetting
.
Name
+
"_"
+
latestVersion
+
"/*"
,
absPath
)
mv
:=
exec
.
Command
(
"mv"
,
pwd
+
setting
.
BityuanSetting
.
Name
+
"_"
+
latestVersion
+
"/*"
,
absPath
)
s
err
:=
bytes
.
NewBuffer
(
nil
)
mv
err
:=
bytes
.
NewBuffer
(
nil
)
mv
.
Stderr
=
s
err
mv
.
Stderr
=
mv
err
err
=
mv
.
Start
()
err
=
mv
.
Start
()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Println
(
"mv"
,
err
)
log
.
Println
(
"mv"
,
err
)
...
@@ -174,9 +180,8 @@ func UpdateNode(c *gin.Context){
...
@@ -174,9 +180,8 @@ func UpdateNode(c *gin.Context){
}
}
err
=
mv
.
Wait
()
err
=
mv
.
Wait
()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Println
(
"mv1"
,
err
)
log
.
Println
(
"stderr:"
,
mverr
.
String
())
log
.
Println
(
"stderr:"
,
serr
.
String
())
appG
.
Response
(
http
.
StatusOK
,
e
.
MV_ERROR
,
mverr
.
String
())
appG
.
Response
(
http
.
StatusOK
,
e
.
MV_ERROR
,
err
)
app
.
UpdateInfo
.
Flag
=
true
app
.
UpdateInfo
.
Flag
=
true
app
.
BityuanFlag
=
false
app
.
BityuanFlag
=
false
return
return
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment