MCPcopy Create free account
hub / github.com/ember-cli/ember-cli / capture

Function capture

lib/utilities/will-interrupt-process.js:21–44  ·  view source on GitHub ↗
(outerProcess)

Source from the content-addressed store, hash-verified

19
20module.exports = {
21 capture(outerProcess) {
22 if (_process) {
23 throw new Error(`process already captured at: \n\n${_processCapturedLocation.stack}`);
24 }
25
26 if (isEventEmitterCompatible(outerProcess) === false) {
27 throw new Error('attempt to capture bad process instance');
28 }
29
30 _process = outerProcess;
31 _processCapturedLocation = new Error();
32
33 // ember-cli and user apps have many dependencies, many of which require
34 // process.addListener('exit', ....) for cleanup, by default this limit for
35 // such listeners is 10, recently users have been increasing this and not to
36 // their fault, rather they are including large and more diverse sets of
37 // node_modules.
38 //
39 // https://github.com/babel/ember-cli-babel/issues/76
40 _process.setMaxListeners(1000);
41
42 // work around misbehaving libraries, so we can correctly cleanup before actually exiting.
43 captureExit.captureExit();
44 },
45
46 /**
47 * Drops all the interruption handlers and disables an ability to add new one

Callers

nothing calls this directly

Calls 1

isEventEmitterCompatibleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…