MCPcopy
hub / github.com/microsoft/vscode-js-debug / shouldSmartAttach

Function shouldSmartAttach

src/targets/node/bootloader.ts:225–233  ·  view source on GitHub ↗

* Returns whether to smart attach. The goal here is to avoid attaching to * scripts like `npm` or `webpack` which the user probably doesn't want to * debug. Unfortunately Node doesn't expose the originally argv to us where * we could detect a direct invokation of something like `npm install`, *

(env: IBootloaderInfo)

Source from the content-addressed store, hash-verified

223 * so we match against the script name.
224 */
225function shouldSmartAttach(env: IBootloaderInfo) {
226 const script: string | undefined = process.argv[1];
227 if (!script) {
228 return true; // node REPL
229 }
230
231 // otherwise, delegate to the patterns. Defaults exclude node_modules
232 return autoAttachSmartPatternMatches(script, env);
233}
234
235function autoAttachSmartPatternMatches(script: string, env: IBootloaderInfo) {
236 if (!env.aaPatterns) {

Callers 1

Calls 1

Tested by

no test coverage detected