Skip to content

Commit 41843ad

Browse files
nlfwraithgar
authored andcommitted
fix: use an absolute path to notepad.exe by default, correct docs
1 parent ac25863 commit 41843ad

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed

lib/utils/config/definitions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const buildOmitList = obj => {
6060

6161
const editor = process.env.EDITOR ||
6262
process.env.VISUAL ||
63-
(isWindows ? 'notepad.exe' : 'vi')
63+
(isWindows ? `${process.env.SYSTEMROOT}\\notepad.exe` : 'vi')
6464

6565
const shell = isWindows ? process.env.ComSpec || 'cmd'
6666
: process.env.SHELL || 'sh'
@@ -628,8 +628,8 @@ define('dry-run', {
628628
define('editor', {
629629
default: editor,
630630
defaultDescription: `
631-
The EDITOR or VISUAL environment variables, or 'notepad.exe' on Windows,
632-
or 'vim' on Unix systems
631+
The EDITOR or VISUAL environment variables, or '%SYSTEMROOT%\\notepad.exe' on Windows,
632+
or 'vi' on Unix systems
633633
`,
634634
type: String,
635635
description: `

tap-snapshots/test/lib/docs.js.test.cjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -874,8 +874,8 @@ Note: This is NOT honored by other network related commands, eg \`dist-tags\`,
874874
875875
#### \`editor\`
876876
877-
* Default: The EDITOR or VISUAL environment variables, or 'notepad.exe' on
878-
Windows, or 'vim' on Unix systems
877+
* Default: The EDITOR or VISUAL environment variables, or
878+
'%SYSTEMROOT%\\notepad.exe' on Windows, or 'vi' on Unix systems
879879
* Type: String
880880
881881
The command to run for \`npm edit\` and \`npm config edit\`.

test/lib/utils/config/definitions.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ t.test('editor', t => {
3333
t.end()
3434
})
3535
t.test('has neither EDITOR nor VISUAL, system specific', t => {
36-
mockGlobals(t, { 'process.env': { EDITOR: undefined, VISUAL: undefined } })
36+
mockGlobals(t, {
37+
'process.env': {
38+
EDITOR: undefined,
39+
VISUAL: undefined,
40+
SYSTEMROOT: 'C:\\Windows',
41+
},
42+
})
3743
const defsWin = mockDefs(isWin(true))
38-
t.equal(defsWin.editor.default, 'notepad.exe')
44+
t.equal(defsWin.editor.default, 'C:\\Windows\\notepad.exe')
3945
const defsNix = mockDefs(isWin(false))
4046
t.equal(defsNix.editor.default, 'vi')
4147
t.end()

0 commit comments

Comments
 (0)