We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 016291a commit 7028b23Copy full SHA for 7028b23
server/src/util/sh.ts
@@ -10,17 +10,20 @@ export function execShellScript(body: string): Promise<string> {
10
return new Promise((resolve, reject) => {
11
let output = ''
12
13
- process.stdout.on('data', buffer => {
14
- output += buffer
15
- })
16
-
17
- process.on('close', returnCode => {
+ const handleClose = (returnCode: number | Error) => {
18
if (returnCode === 0) {
19
resolve(output)
20
} else {
21
reject(`Failed to execute ${body}`)
22
}
+ }
+
+ process.stdout.on('data', buffer => {
+ output += buffer
23
})
24
25
+ process.on('close', handleClose)
26
+ process.on('error', handleClose)
27
28
29
0 commit comments