Skip to content

Commit

Permalink
Fixed issue where error output from parcel (or tsc) would kill the ap…
Browse files Browse the repository at this point in the history
…plication
  • Loading branch information
UncleSamSwiss committed Mar 18, 2021
1 parent fbc816c commit 0c48a95
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 13 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@
## __WORK IN PROGRESS__
-->

## __WORK IN PROGRESS__

- (UncleSamSwiss) Disabled license info dialog at first start-up (#10)
- (UncleSamSwiss) Fixed issue on MacOS about "COMMAND" property (#11)
- (UncleSamSwiss) Fixed issue where error output from parcel (or tsc) would kill the application

## 0.1.2 (2021-02-25)

- (UncleSamSwiss) Fixed automatic NPM deployment.
Expand Down
10 changes: 3 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -711,20 +711,16 @@ class DevServer {
}
spawnAndAwaitOutput(command, args, cwd, awaitMsg, options) {
return new Promise((resolve, reject) => {
var _a, _b;
const proc = this.spawn(command, args, cwd, { ...options, stdio: ['ignore', 'pipe', 'pipe'] });
var _a;
const proc = this.spawn(command, args, cwd, { ...options, stdio: ['ignore', 'pipe', 'inherit'] });
(_a = proc.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
const str = data.toString('utf-8');
console.log(str.trimEnd());
if (str.includes(awaitMsg)) {
resolve(proc);
}
});
(_b = proc.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
const str = data.toString('utf-8').trimEnd();
console.error(str);
reject(str);
});
proc.on('exit', (code) => reject(`Exited with ${code}`));
process.on('SIGINT', () => {
proc.kill();
reject('SIGINT');
Expand Down
8 changes: 2 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -832,19 +832,15 @@ class DevServer {
options?: cp.SpawnOptions,
): Promise<cp.ChildProcess> {
return new Promise<cp.ChildProcess>((resolve, reject) => {
const proc = this.spawn(command, args, cwd, { ...options, stdio: ['ignore', 'pipe', 'pipe'] });
const proc = this.spawn(command, args, cwd, { ...options, stdio: ['ignore', 'pipe', 'inherit'] });
proc.stdout?.on('data', (data: Buffer) => {
const str = data.toString('utf-8');
console.log(str.trimEnd());
if (str.includes(awaitMsg)) {
resolve(proc);
}
});
proc.stderr?.on('data', (data: Buffer) => {
const str = data.toString('utf-8').trimEnd();
console.error(str);
reject(str);
});
proc.on('exit', (code) => reject(`Exited with ${code}`));
process.on('SIGINT', () => {
proc.kill();
reject('SIGINT');
Expand Down

0 comments on commit 0c48a95

Please sign in to comment.