Skip to content

Commit

Permalink
fix: update default exec terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
dajiangyou committed Jan 11, 2021
1 parent 8ecf2a4 commit 6917bbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 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
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 6917bbc

Please sign in to comment.