Skip to content

Commit b28b9cd

Browse files
committed
Make deactivate reliable on OSX by using stop() instead of process.kill()
1 parent 399f8c1 commit b28b9cd

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

custom-typings/@james-proxy/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ declare module '@james-proxy/james-browser-launcher' {
4848
process: ChildProcess;
4949
stderr: stream.Readable;
5050
stdout: stream.Readable;
51+
52+
stop(): void;
5153
}
5254
}
5355

src/interceptors/fresh-chrome.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ export class FreshChrome {
6666
async deactivate(proxyPort: number) {
6767
if (this.isActive(proxyPort)) {
6868
const browser = browsers[proxyPort];
69-
browser!.process.kill();
70-
await new Promise((resolve) => browser!.process.once('exit', resolve));
69+
const exitPromise = new Promise((resolve) => browser!.process.once('exit', resolve));
70+
browser!.stop();
71+
await exitPromise;
7172
}
7273
}
7374
};

src/interceptors/fresh-firefox.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,9 @@ export class FreshFirefox {
100100
async deactivate(proxyPort: number) {
101101
if (this.isActive(proxyPort)) {
102102
const browser = browsers[proxyPort];
103-
browser!.process.kill();
104-
await new Promise((resolve) => browser!.process.once('exit', resolve));
103+
const exitPromise = new Promise((resolve) => browser!.process.once('exit', resolve));
104+
browser!.stop();
105+
await exitPromise;
105106
}
106107
}
107108
};

0 commit comments

Comments
 (0)