Skip to content

Commit

Permalink
fix treeKill
Browse files Browse the repository at this point in the history
  • Loading branch information
midleman committed Jan 6, 2025
1 parent 57db7de commit 71f82c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions test/e2e/infra/code.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@

import * as cp from 'child_process';
import * as os from 'os';
import * as treekill from 'tree-kill';
import treeKill from 'tree-kill';
import { ILogFile } from './driver';
import { Logger, measureAndLog } from './logger';
import { launch as launchPlaywrightBrowser } from './playwrightBrowser';
import { PlaywrightDriver } from './playwrightDriver';
import { launch as launchPlaywrightElectron } from './playwrightElectron';
import { teardown } from './processes';


export interface LaunchOptions {
codePath?: string;
readonly workspacePath: string;
Expand Down Expand Up @@ -160,7 +161,7 @@ export class Code {
this.logger.log('Smoke test exit call did not terminate process after 20s, forcefully exiting the application...');

// no need to await since we're polling for the process to die anyways
treekill(pid, err => {
treeKill(pid, err => {
try {
process.kill(pid, 0); // throws an exception if the process doesn't exist anymore
this.logger.log('Failed to kill Electron process tree:', err?.message);
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/infra/processes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { ChildProcess } from 'child_process';
import { promisify } from 'util';
import * as treekill from 'tree-kill';
import treeKill from 'tree-kill';
import { Logger } from './logger';

export async function teardown(p: ChildProcess, logger: Logger, retryCount = 3): Promise<void> {
Expand All @@ -19,7 +19,7 @@ export async function teardown(p: ChildProcess, logger: Logger, retryCount = 3):
retries++;

try {
return await promisify(treekill)(pid);
return await promisify(treeKill)(pid);
} catch (error) {
try {
process.kill(pid, 0); // throws an exception if the process doesn't exist anymore
Expand Down
2 changes: 2 additions & 0 deletions test/e2e/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"compilerOptions": {
"module": "commonjs",
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"noImplicitAny": false,
"removeComments": false,
"preserveConstEnums": true,
Expand Down

0 comments on commit 71f82c1

Please sign in to comment.