fix(codegen): SIGINT handling was leading to zombie processes (#33269)
This commit is contained in:
parent
0509eca9b6
commit
a2dec8da63
|
@ -554,6 +554,7 @@ async function open(options: Options, url: string | undefined, language: string)
|
|||
contextOptions,
|
||||
device: options.device,
|
||||
saveStorage: options.saveStorage,
|
||||
handleSIGINT: false,
|
||||
});
|
||||
await openPage(context, url);
|
||||
}
|
||||
|
@ -577,6 +578,7 @@ async function codegen(options: Options & { target: string, output?: string, tes
|
|||
codegenMode: process.env.PW_RECORDER_IS_TRACE_VIEWER ? 'trace-events' : 'actions',
|
||||
testIdAttributeName,
|
||||
outputFile: outputFile ? path.resolve(outputFile) : undefined,
|
||||
handleSIGINT: false,
|
||||
});
|
||||
await openPage(context, url);
|
||||
}
|
||||
|
|
|
@ -976,6 +976,7 @@ scheme.BrowserContextEnableRecorderParams = tObject({
|
|||
device: tOptional(tString),
|
||||
saveStorage: tOptional(tString),
|
||||
outputFile: tOptional(tString),
|
||||
handleSIGINT: tOptional(tBoolean),
|
||||
omitCallTracking: tOptional(tBoolean),
|
||||
});
|
||||
scheme.BrowserContextEnableRecorderResult = tOptional(tObject({}));
|
||||
|
|
|
@ -34,6 +34,7 @@ import { buildFullSelector } from '../utils/isomorphic/recorderUtils';
|
|||
const recorderSymbol = Symbol('recorderSymbol');
|
||||
|
||||
export class Recorder implements InstrumentationListener, IRecorder {
|
||||
readonly handleSIGINT: boolean | undefined;
|
||||
private _context: BrowserContext;
|
||||
private _mode: Mode;
|
||||
private _highlightedSelector = '';
|
||||
|
@ -75,6 +76,7 @@ export class Recorder implements InstrumentationListener, IRecorder {
|
|||
|
||||
constructor(codegenMode: 'actions' | 'trace-events', context: BrowserContext, params: channels.BrowserContextEnableRecorderParams) {
|
||||
this._mode = params.mode || 'none';
|
||||
this.handleSIGINT = params.handleSIGINT;
|
||||
this._contextRecorder = new ContextRecorder(codegenMode, context, params, {});
|
||||
this._context = context;
|
||||
this._omitCallTracking = !!params.omitCallTracking;
|
||||
|
|
|
@ -111,7 +111,7 @@ export class RecorderApp extends EventEmitter implements IRecorderApp {
|
|||
noDefaultViewport: true,
|
||||
headless: !!process.env.PWTEST_CLI_HEADLESS || (isUnderTest() && !headed),
|
||||
useWebSocket: isUnderTest(),
|
||||
handleSIGINT: false,
|
||||
handleSIGINT: recorder.handleSIGINT,
|
||||
executablePath: inspectedContext._browser.options.isChromium ? inspectedContext._browser.options.customExecutablePath : undefined,
|
||||
}
|
||||
});
|
||||
|
|
|
@ -21,6 +21,7 @@ import type { EventEmitter } from 'events';
|
|||
export interface IRecorder {
|
||||
setMode(mode: Mode): void;
|
||||
mode(): Mode;
|
||||
readonly handleSIGINT: boolean | undefined;
|
||||
}
|
||||
|
||||
export interface IRecorderApp extends EventEmitter {
|
||||
|
|
|
@ -1777,6 +1777,7 @@ export type BrowserContextEnableRecorderParams = {
|
|||
device?: string,
|
||||
saveStorage?: string,
|
||||
outputFile?: string,
|
||||
handleSIGINT?: boolean,
|
||||
omitCallTracking?: boolean,
|
||||
};
|
||||
export type BrowserContextEnableRecorderOptions = {
|
||||
|
@ -1790,6 +1791,7 @@ export type BrowserContextEnableRecorderOptions = {
|
|||
device?: string,
|
||||
saveStorage?: string,
|
||||
outputFile?: string,
|
||||
handleSIGINT?: boolean,
|
||||
omitCallTracking?: boolean,
|
||||
};
|
||||
export type BrowserContextEnableRecorderResult = void;
|
||||
|
|
|
@ -1208,6 +1208,7 @@ BrowserContext:
|
|||
device: string?
|
||||
saveStorage: string?
|
||||
outputFile: string?
|
||||
handleSIGINT: boolean?
|
||||
omitCallTracking: boolean?
|
||||
|
||||
newCDPSession:
|
||||
|
|
Loading…
Reference in New Issue