Skip to content

Commit

Permalink
Fix fatal error when there are no new changes (#18)
Browse files Browse the repository at this point in the history
* Add clause to not fatal error if no changes

* Run prettier

* Run build

* edit stdio options

* build again
  • Loading branch information
TechPhil authored and jamesgeorge007 committed Aug 23, 2020
1 parent 4bb92fb commit fad7c96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1518,9 +1518,13 @@ const toUrlFormat = (item) => {

const exec = (cmd, args = []) =>
new Promise((resolve, reject) => {
const app = spawn(cmd, args, { stdio: "inherit" });
const app = spawn(cmd, args, { stdio: "pipe" });
let stdout = "";
app.stdout.on("data", (data) => {
stdout = data;
});
app.on("close", (code) => {
if (code !== 0) {
if (code !== 0 && !stdout.includes("nothing to commit")) {
err = new Error(`Invalid status code: ${code}`);
err.code = code;
return reject(err);
Expand Down
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,13 @@ const toUrlFormat = (item) => {

const exec = (cmd, args = []) =>
new Promise((resolve, reject) => {
const app = spawn(cmd, args, { stdio: "inherit" });
const app = spawn(cmd, args, { stdio: "pipe" });
let stdout = "";
app.stdout.on("data", (data) => {
stdout = data;
});
app.on("close", (code) => {
if (code !== 0) {
if (code !== 0 && !stdout.includes("nothing to commit")) {
err = new Error(`Invalid status code: ${code}`);
err.code = code;
return reject(err);
Expand Down

0 comments on commit fad7c96

Please sign in to comment.