Skip to content

Commit

Permalink
Improve subprocess error message
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashaag committed Mar 10, 2022
1 parent 1d61a51 commit a6ea291
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
16 changes: 12 additions & 4 deletions dist/main/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,20 @@ function getInputAsArray (name) {
.filter(x => x !== '')
}

async function executeBash (command) {
await exec('bash', ['-c', command])
async function executeShell (...command) {
try {
await exec(command[0], command.slice(1))
} catch (error) {
throw Error(`Failed to execute ${JSON.stringify(command)}`)
}
}

function executeBash (command) {
return executeShell('bash', '-c', command)
}

async function executePwsh (command) {
await exec('powershell', ['-command', command])
function executePwsh (command) {
return executeShell('powershell', '-command', command)
}

async function tryRestoreCache (path, key, ...args) {
Expand Down

0 comments on commit a6ea291

Please sign in to comment.