MCPcopy Index your code
hub / github.com/nodejs/node / exec

Method exec

deps/npm/lib/commands/edit.js:41–61  ·  view source on GitHub ↗
(args)

Source from the content-addressed store, hash-verified

39 }
40
41 async exec (args) {
42 if (args.length !== 1) {
43 throw this.usageError()
44 }
45
46 const path = splitPackageNames(args[0])
47 const dir = resolve(this.npm.dir, path)
48
49 await lstat(dir)
50 await input.start(() => new Promise((res, rej) => {
51 const [bin, ...spawnArgs] = this.npm.config.get('editor').split(/\s+/)
52 const editor = cp.spawn(bin, [...spawnArgs, dir], { stdio: 'inherit' })
53 editor.on('exit', (code) => {
54 if (code) {
55 return rej(new Error(`editor process exited with code: ${code}`))
56 }
57 res()
58 })
59 }))
60 await this.npm.exec('rebuild', [dir])
61 }
62}
63
64module.exports = Edit

Callers

nothing calls this directly

Calls 8

splitPackageNamesFunction · 0.85
usageErrorMethod · 0.80
getMethod · 0.65
resolveFunction · 0.50
lstatFunction · 0.50
startMethod · 0.45
splitMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected