Skip to content

Commit 9a4077f

Browse files
author
Amelia Wattenbeger
committed
reject exec errors
1 parent 807ae01 commit 9a4077f

File tree

2 files changed

+32
-22
lines changed

2 files changed

+32
-22
lines changed

index.js

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15089,19 +15089,24 @@ var main = async () => {
1508915089
console.log("All set!");
1509015090
};
1509115091
main();
15092-
function execWithOutput(command, options) {
15092+
function execWithOutput(command, args) {
1509315093
return new Promise(function(resolve, reject) {
15094-
(0, import_exec.exec)(command, options, {
15095-
listeners: {
15096-
stdout: function(res) {
15097-
resolve(res.toString());
15098-
},
15099-
stderr: function(res) {
15100-
core.info(res.toString());
15101-
reject(res.toString());
15094+
try {
15095+
(0, import_exec.exec)(command, args, {
15096+
listeners: {
15097+
stdout: function(res) {
15098+
core.info(res.toString());
15099+
resolve(res.toString());
15100+
},
15101+
stderr: function(res) {
15102+
core.info(res.toString());
15103+
reject(res.toString());
15104+
}
1510215105
}
15103-
}
15104-
});
15106+
});
15107+
} catch (e) {
15108+
reject(e);
15109+
}
1510515110
});
1510615111
}
1510715112
/*

src/index.jsx

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,24 @@ const main = async () => {
4545

4646
main()
4747

48-
function execWithOutput(command, options) {
48+
function execWithOutput(command, args) {
4949
return new Promise(function (resolve, reject) {
50-
exec(command, options, {
51-
listeners: {
52-
stdout: function (res) {
53-
resolve(res.toString())
54-
},
55-
stderr: function (res) {
56-
core.info(res.toString())
57-
reject(res.toString())
50+
try {
51+
exec(command, args, {
52+
listeners: {
53+
stdout: function (res) {
54+
core.info(res.toString())
55+
resolve(res.toString())
56+
},
57+
stderr: function (res) {
58+
core.info(res.toString())
59+
reject(res.toString())
60+
}
5861
}
59-
}
60-
})
62+
})
63+
} catch (e) {
64+
reject(e)
65+
}
6166
})
6267
}
6368

0 commit comments

Comments
 (0)