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,
|
contextOptions,
|
||||||
device: options.device,
|
device: options.device,
|
||||||
saveStorage: options.saveStorage,
|
saveStorage: options.saveStorage,
|
||||||
|
handleSIGINT: false,
|
||||||
});
|
});
|
||||||
await openPage(context, url);
|
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',
|
codegenMode: process.env.PW_RECORDER_IS_TRACE_VIEWER ? 'trace-events' : 'actions',
|
||||||
testIdAttributeName,
|
testIdAttributeName,
|
||||||
outputFile: outputFile ? path.resolve(outputFile) : undefined,
|
outputFile: outputFile ? path.resolve(outputFile) : undefined,
|
||||||
|
handleSIGINT: false,
|
||||||
});
|
});
|
||||||
await openPage(context, url);
|
await openPage(context, url);
|
||||||
}
|
}
|
||||||
|
|
|
@ -976,6 +976,7 @@ scheme.BrowserContextEnableRecorderParams = tObject({
|
||||||
device: tOptional(tString),
|
device: tOptional(tString),
|
||||||
saveStorage: tOptional(tString),
|
saveStorage: tOptional(tString),
|
||||||
outputFile: tOptional(tString),
|
outputFile: tOptional(tString),
|
||||||
|
handleSIGINT: tOptional(tBoolean),
|
||||||
omitCallTracking: tOptional(tBoolean),
|
omitCallTracking: tOptional(tBoolean),
|
||||||
});
|
});
|
||||||
scheme.BrowserContextEnableRecorderResult = tOptional(tObject({}));
|
scheme.BrowserContextEnableRecorderResult = tOptional(tObject({}));
|
||||||
|
|
|
@ -34,6 +34,7 @@ import { buildFullSelector } from '../utils/isomorphic/recorderUtils';
|
||||||
const recorderSymbol = Symbol('recorderSymbol');
|
const recorderSymbol = Symbol('recorderSymbol');
|
||||||
|
|
||||||
export class Recorder implements InstrumentationListener, IRecorder {
|
export class Recorder implements InstrumentationListener, IRecorder {
|
||||||
|
readonly handleSIGINT: boolean | undefined;
|
||||||
private _context: BrowserContext;
|
private _context: BrowserContext;
|
||||||
private _mode: Mode;
|
private _mode: Mode;
|
||||||
private _highlightedSelector = '';
|
private _highlightedSelector = '';
|
||||||
|
@ -75,6 +76,7 @@ export class Recorder implements InstrumentationListener, IRecorder {
|
||||||
|
|
||||||
constructor(codegenMode: 'actions' | 'trace-events', context: BrowserContext, params: channels.BrowserContextEnableRecorderParams) {
|
constructor(codegenMode: 'actions' | 'trace-events', context: BrowserContext, params: channels.BrowserContextEnableRecorderParams) {
|
||||||
this._mode = params.mode || 'none';
|
this._mode = params.mode || 'none';
|
||||||
|
this.handleSIGINT = params.handleSIGINT;
|
||||||
this._contextRecorder = new ContextRecorder(codegenMode, context, params, {});
|
this._contextRecorder = new ContextRecorder(codegenMode, context, params, {});
|
||||||
this._context = context;
|
this._context = context;
|
||||||
this._omitCallTracking = !!params.omitCallTracking;
|
this._omitCallTracking = !!params.omitCallTracking;
|
||||||
|
|
|
@ -111,7 +111,7 @@ export class RecorderApp extends EventEmitter implements IRecorderApp {
|
||||||
noDefaultViewport: true,
|
noDefaultViewport: true,
|
||||||
headless: !!process.env.PWTEST_CLI_HEADLESS || (isUnderTest() && !headed),
|
headless: !!process.env.PWTEST_CLI_HEADLESS || (isUnderTest() && !headed),
|
||||||
useWebSocket: isUnderTest(),
|
useWebSocket: isUnderTest(),
|
||||||
handleSIGINT: false,
|
handleSIGINT: recorder.handleSIGINT,
|
||||||
executablePath: inspectedContext._browser.options.isChromium ? inspectedContext._browser.options.customExecutablePath : undefined,
|
executablePath: inspectedContext._browser.options.isChromium ? inspectedContext._browser.options.customExecutablePath : undefined,
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,6 +21,7 @@ import type { EventEmitter } from 'events';
|
||||||
export interface IRecorder {
|
export interface IRecorder {
|
||||||
setMode(mode: Mode): void;
|
setMode(mode: Mode): void;
|
||||||
mode(): Mode;
|
mode(): Mode;
|
||||||
|
readonly handleSIGINT: boolean | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IRecorderApp extends EventEmitter {
|
export interface IRecorderApp extends EventEmitter {
|
||||||
|
|
|
@ -1777,6 +1777,7 @@ export type BrowserContextEnableRecorderParams = {
|
||||||
device?: string,
|
device?: string,
|
||||||
saveStorage?: string,
|
saveStorage?: string,
|
||||||
outputFile?: string,
|
outputFile?: string,
|
||||||
|
handleSIGINT?: boolean,
|
||||||
omitCallTracking?: boolean,
|
omitCallTracking?: boolean,
|
||||||
};
|
};
|
||||||
export type BrowserContextEnableRecorderOptions = {
|
export type BrowserContextEnableRecorderOptions = {
|
||||||
|
@ -1790,6 +1791,7 @@ export type BrowserContextEnableRecorderOptions = {
|
||||||
device?: string,
|
device?: string,
|
||||||
saveStorage?: string,
|
saveStorage?: string,
|
||||||
outputFile?: string,
|
outputFile?: string,
|
||||||
|
handleSIGINT?: boolean,
|
||||||
omitCallTracking?: boolean,
|
omitCallTracking?: boolean,
|
||||||
};
|
};
|
||||||
export type BrowserContextEnableRecorderResult = void;
|
export type BrowserContextEnableRecorderResult = void;
|
||||||
|
|
|
@ -1208,6 +1208,7 @@ BrowserContext:
|
||||||
device: string?
|
device: string?
|
||||||
saveStorage: string?
|
saveStorage: string?
|
||||||
outputFile: string?
|
outputFile: string?
|
||||||
|
handleSIGINT: boolean?
|
||||||
omitCallTracking: boolean?
|
omitCallTracking: boolean?
|
||||||
|
|
||||||
newCDPSession:
|
newCDPSession:
|
||||||
|
|
Loading…
Reference in New Issue