Skip to content

Commit

Permalink
propagate exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
gasnier committed May 16, 2021
1 parent 72941e1 commit bdd7c0d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions README.md
Expand Up @@ -43,6 +43,9 @@ lpx command2 command2arguments
## Real life usage
If you have installed typescript in a local package and want to build your typescript project and its referenced projects in watch mode from the command line you can run ``lpx tsc -b -w``

## Exit code
The exit code of the executed command is propagated (ie if `command` exits with 99 error code, `lpx command` will exit with 99 as well)

## Motivations
At [Cervval](https://www.cervval.com), our packages are organised in a workspace that has a package.json that determines the versions of the build tools we use (tsc, webpack...)

Expand Down
8 changes: 7 additions & 1 deletion bin/lpx.js
Expand Up @@ -43,4 +43,10 @@ if (!found) {
const cmd = path.resolve(workingDir, binPath) + path.sep + args.join(" ");

// execute command
child_process.execSync(cmd, { stdio: "inherit" });
try {
child_process.execSync(cmd, { stdio: "inherit" });
} catch (err) {
process.stdout.write("");//flush
process.stderr.write("");//flush
process.exit(err.status);//propagate error code
}
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "lpx",
"version": "1.0.3",
"version": "1.0.4",
"description": "Local Package eXecute",
"author": "Bruno Gasnier (https://www.cervval.com/)",
"homepage": "https://github.com/gasnier/lpx",
Expand Down

0 comments on commit bdd7c0d

Please sign in to comment.