Skip to content

Commit

Permalink
Merge pull request #77 from codematters-pl/fix-exit-code
Browse files Browse the repository at this point in the history
Fixed thrown error code in case of error
  • Loading branch information
miensol committed May 27, 2022
2 parents 4754be3 + 27cc3ed commit d483b3b
Show file tree
Hide file tree
Showing 3 changed files with 392 additions and 165 deletions.
6 changes: 3 additions & 3 deletions packages/cloudform/cli/cloudform.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ const resolvedTemplatePath = path.resolve(options.templatePath)
child_process_1.exec('npm bin', (err, npmBin) => {
if (err) {
console.error(err);
return;
process.exit(err.code);
}
const tsNodePath = path.join(npmBin.trim(), 'ts-node');
child_process_1.exec(`${tsNodePath} -e "import t from '${resolvedTemplatePath}'; console.log(t)"`, { maxBuffer: 1024 * 1024 * 5 }, (err, template, stderr) => {
if (err) {
console.error(err);
return;
process.exit(err.code);
}
if (stderr) {
console.error(stderr);
return;
process.exit(1);
}
if (options.shouldMinify) {
console.log(jsonminify(template));
Expand Down
6 changes: 3 additions & 3 deletions packages/cloudform/cli/cloudform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,18 @@ const resolvedTemplatePath = path.resolve(options.templatePath!)
exec('npm bin', (err, npmBin) => {
if (err) {
console.error(err)
return
process.exit(err.code)
}

const tsNodePath = path.join(npmBin.trim(), 'ts-node')
exec(`${tsNodePath} -e "import t from '${resolvedTemplatePath}'; console.log(t)"`, {maxBuffer: 1024 * 1024 * 5}, (err, template, stderr) => {
if (err) {
console.error(err)
return
process.exit(err.code)
}
if (stderr) {
console.error(stderr)
return
process.exit(1);
}

if (options.shouldMinify) {
Expand Down
Loading

0 comments on commit d483b3b

Please sign in to comment.