diff --git a/src/renderer/store/task-mixin.js b/src/renderer/store/task-mixin.js index 7c980c5..b02bc4a 100644 --- a/src/renderer/store/task-mixin.js +++ b/src/renderer/store/task-mixin.js @@ -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 () { @@ -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() }) }) }, diff --git a/src/renderer/views/home/TaskCenter.vue b/src/renderer/views/home/TaskCenter.vue index f3f549a..72a0d66 100644 --- a/src/renderer/views/home/TaskCenter.vue +++ b/src/renderer/views/home/TaskCenter.vue @@ -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) diff --git a/src/renderer/views/home/TaskForm.vue b/src/renderer/views/home/TaskForm.vue index 71cb749..af388f8 100644 --- a/src/renderer/views/home/TaskForm.vue +++ b/src/renderer/views/home/TaskForm.vue @@ -78,7 +78,7 @@ local build command ( path | command ) @@ -93,7 +93,7 @@ local clean command ( path | command )