Skip to content

Commit fad7c96

Browse files
TechPhiljamesgeorge007
authored andcommitted
Fix fatal error when there are no new changes (#18)
* Add clause to not fatal error if no changes * Run prettier * Run build * edit stdio options * build again
1 parent 4bb92fb commit fad7c96

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

dist/index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1518,9 +1518,13 @@ const toUrlFormat = (item) => {
15181518

15191519
const exec = (cmd, args = []) =>
15201520
new Promise((resolve, reject) => {
1521-
const app = spawn(cmd, args, { stdio: "inherit" });
1521+
const app = spawn(cmd, args, { stdio: "pipe" });
1522+
let stdout = "";
1523+
app.stdout.on("data", (data) => {
1524+
stdout = data;
1525+
});
15221526
app.on("close", (code) => {
1523-
if (code !== 0) {
1527+
if (code !== 0 && !stdout.includes("nothing to commit")) {
15241528
err = new Error(`Invalid status code: ${code}`);
15251529
err.code = code;
15261530
return reject(err);

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,13 @@ const toUrlFormat = (item) => {
4343

4444
const exec = (cmd, args = []) =>
4545
new Promise((resolve, reject) => {
46-
const app = spawn(cmd, args, { stdio: "inherit" });
46+
const app = spawn(cmd, args, { stdio: "pipe" });
47+
let stdout = "";
48+
app.stdout.on("data", (data) => {
49+
stdout = data;
50+
});
4751
app.on("close", (code) => {
48-
if (code !== 0) {
52+
if (code !== 0 && !stdout.includes("nothing to commit")) {
4953
err = new Error(`Invalid status code: ${code}`);
5054
err.code = code;
5155
return reject(err);

0 commit comments

Comments
 (0)