Skip to content

Commit

Permalink
WIP on fix for gilamran#87. Only implemented for compilationComplete …
Browse files Browse the repository at this point in the history
…so far.
  • Loading branch information
david-alexander committed Mar 22, 2022
1 parent a78bc97 commit 935d7d2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
16 changes: 16 additions & 0 deletions lib/tsc-watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ const run = require('./runner');
const { extractArgs } = require('./args-manager');
const { manipulate, detectState, deleteClear, print } = require('./stdout-manipulator');
const readline = require('readline');
const CancellationToken = require('cancellationtoken').default;

let firstTime = true;
let firstSuccessKiller = null;
let successKiller = null;
let failureKiller = null;
let compilationStartedKiller = null;
let compilationCompleteKiller = null;
let compilationCompleteCancel = null;

const {
onFirstSuccessCommand,
Expand Down Expand Up @@ -122,7 +124,21 @@ rl.on('line', function (input) {
}

if (compilationComplete) {
if (compilationCompleteCancel)
{
compilationCompleteCancel();
compilationCompleteCancel = null;
}

const { cancel, token } = CancellationToken.create();
compilationCompleteCancel = cancel;

killProcesses(false).then(() => {
if (token.isCancelled)
{
return;
}

runOnCompilationComplete();

if (compilationErrorSinceStart) {
Expand Down
15 changes: 13 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"printWidth": 100
},
"dependencies": {
"cancellationtoken": "^2.2.0",
"cross-spawn": "^7.0.3",
"node-cleanup": "^2.1.2",
"ps-tree": "^1.2.0",
Expand Down

0 comments on commit 935d7d2

Please sign in to comment.