forked from JamesIves/github-pages-deploy-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexecute.ts
More file actions
33 lines (28 loc) · 778 Bytes
/
Copy pathexecute.ts
File metadata and controls
33 lines (28 loc) · 778 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import {exec} from '@actions/exec'
let output: string
/** Wrapper around the GitHub toolkit exec command which returns the output.
* Also allows you to easily toggle the current working directory.
*
* @param {string} cmd - The command to execute.
* @param {string} cwd - The current working directory.
* @param {boolean} silent - Determines if the in/out should be silenced or not.
*/
export async function execute(
cmd: string,
cwd: string,
silent: boolean
): Promise<any> {
output = ''
await exec(cmd, [], {
// Silences the input unless the INPUT_DEBUG flag is set.
silent,
cwd,
listeners: {
stdout
}
})
return Promise.resolve(output)
}
export function stdout(data: any): string | void {
output += data.toString().trim()
}