Skip to content

Commit

Permalink
Merge pull request #13 from aotianwinter/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
aotianwinter authored Jan 11, 2021
2 parents 59d17d0 + 6917bbc commit 86319cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
11 changes: 5 additions & 6 deletions src/renderer/store/task-mixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const fs = require('fs')
const join = require('path').join
const archiver = require('archiver')
const { exec } = require('child_process')
const os = require('os')

const taskMixin = {
data () {
Expand Down Expand Up @@ -170,17 +169,17 @@ const taskMixin = {
_runLocalCommand (command, path = '/', taskId) {
return new Promise((resolve, reject) => {
this._addTaskLogByTaskId(taskId, `${command} 执行中...`)
const terminal = os.type() === 'Windows_NT' ? 'powershell.exe ' : ''
exec(terminal + command, { cwd: path }, (error, stdout, stderr) => {
exec(command, { cwd: path }, (error, stdout, stderr) => {
if (error) {
this._addTaskLogByTaskId(taskId, `${command} 执行发生错误!`, 'error')
this._addTaskLogByTaskId(taskId, stderr, 'error')
this._addTaskLogByTaskId(taskId, '请检查远端环境中该命令是否有效!', 'warning')
reject(error)
} else {
this._addTaskLogByTaskId(taskId, stdout)
this._addTaskLogByTaskId(taskId, `${command} 执行完成!`, 'success')
resolve()
}
this._addTaskLogByTaskId(taskId, stdout)
this._addTaskLogByTaskId(taskId, `${command} 执行完成!`, 'success')
resolve()
})
})
},
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/views/home/TaskCenter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ export default {
if (projectType === 'dir') {
await this._uploadFile(ssh, localFile, deployDir + '/dist.zip', taskId)
await this._runCommand(ssh, 'unzip dist.zip', deployDir, taskId)
await this._runCommand(ssh, 'mv dist ' + releaseDir, deployDir, taskId)
if (releaseDir !== 'dist') await this._runCommand(ssh, 'mv dist ' + releaseDir, deployDir, taskId)
await this._runCommand(ssh, 'rm -f dist.zip', deployDir, taskId)
} else {
await this._uploadFile(ssh, localFile, deployDir + '/' + releaseDir, taskId)
Expand Down
4 changes: 2 additions & 2 deletions src/renderer/views/home/TaskForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
local build command ( path | command )
<a-tooltip>
<template slot="title">
windows: PowerShell<br />
windows: cmd<br />
unix: /bin/sh<br />
请确保符合语法要求 不使用无需填写
</template>
Expand All @@ -93,7 +93,7 @@
local clean command ( path | command )
<a-tooltip>
<template slot="title">
windows: PowerShell<br />
windows: cmd<br />
unix: /bin/sh<br />
请确保符合语法要求 不使用无需填写
</template>
Expand Down

0 comments on commit 86319cb

Please sign in to comment.