MCPcopy Create free account
hub / github.com/microsoft/vscode-js-debug / tryGetProgramFromArgs

Function tryGetProgramFromArgs

src/targets/node/nodeLauncher.ts:41–63  ·  view source on GitHub ↗
(fsUtils: IFsUtils, config: INodeLaunchConfiguration)

Source from the content-addressed store, hash-verified

39 * existent path within the launch arguments.
40 */
41const tryGetProgramFromArgs = async (fsUtils: IFsUtils, config: INodeLaunchConfiguration) => {
42 if (typeof config.stopOnEntry === 'string') {
43 return resolve(config.cwd, config.stopOnEntry);
44 }
45
46 if (config.program) {
47 return resolve(config.cwd, config.program);
48 }
49
50 for (const arg of asArray(config.args)) {
51 if (arg.startsWith('-')) {
52 // looks like a flag
53 continue;
54 }
55
56 const candidate = resolve(config.cwd, arg);
57 if (await fsUtils.exists(candidate)) {
58 return candidate;
59 }
60 }
61
62 return undefined;
63};
64
65@injectable()
66export class NodeLauncher extends NodeLauncherBase<INodeLaunchConfiguration> {

Callers 1

createLifecycleMethod · 0.85

Calls 3

asArrayFunction · 0.90
resolveFunction · 0.85
existsMethod · 0.65

Tested by

no test coverage detected