-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(taskkill): make killing of tasks more relient on windows
- Loading branch information
Showing
8 changed files
with
113 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,4 @@ export default class TestRunnerDecorator implements TestRunner { | |
return Promise.resolve(); | ||
} | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import * as net from 'net'; | ||
import * as log4js from 'log4js'; | ||
import { Subscriber, Observable } from 'rxjs'; | ||
|
||
export default class LoggingServer { | ||
|
||
private readonly server: net.Server; | ||
private subscribers: Subscriber<log4js.LoggingEvent>[] = []; | ||
public readonly event$: Observable<log4js.LoggingEvent>; | ||
|
||
constructor(public readonly port: number) { | ||
this.server = net.createServer(socket => { | ||
socket.on('data', data => { | ||
const str = data.toString(); | ||
try { | ||
const json = JSON.parse(str); | ||
this.subscribers.map(sub => sub.next(json)); | ||
} catch { | ||
// IDLE. Log4js also sends "__LOG4JS__" to signal an event end. Ignore those. | ||
} | ||
}); | ||
}); | ||
this.server.listen(this.port); | ||
|
||
this.event$ = new Observable<log4js.LoggingEvent>(subscriber => { | ||
this.subscribers.push(subscriber); | ||
this.server.on('close', () => { | ||
subscriber.complete(); | ||
}); | ||
}); | ||
} | ||
|
||
dispose(): Promise<void> { | ||
return new Promise((res, rej) => { | ||
this.server.close((err: Error) => { | ||
if (err) { | ||
rej(err); | ||
} else { | ||
res(); | ||
} | ||
}); | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters