Comparing version 0.0.1 to 0.0.2
var isWindows = process.platform === 'win32' | ||
console.error('isWindows = %j', isWindows, process.platform) | ||
var windir = isWindows ? process.env.windir || 'C:\\Windows' : null | ||
@@ -72,1 +71,7 @@ var path = require('path') | ||
memo('editor', function () { | ||
return process.env.EDITOR || | ||
process.env.VISUAL || | ||
(isWindows ? 'notepad.exe' : 'vi') | ||
}) | ||
{ | ||
"name": "osenv", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "osenv.js", | ||
@@ -5,0 +5,0 @@ "directories": { |
@@ -53,1 +53,7 @@ # osenv | ||
executables. | ||
## osenv.editor() | ||
Return the executable name of the editor program. This uses the EDITOR | ||
and VISUAL environment variables, and falls back to `vi` on Unix, or | ||
`notepad.exe` on Windows. |
@@ -22,2 +22,4 @@ // only run this test on windows | ||
process.env.PS1 = '(o_o) $ ' | ||
process.env.EDITOR = 'edit' | ||
process.env.VISUAL = 'visualedit' | ||
@@ -49,3 +51,2 @@ | ||
var osenv = require('../osenv.js') | ||
console.error('osenv.home', osenv.home()) | ||
t.equal(osenv.tmpdir(), '/home/sirUser/tmp') | ||
@@ -58,3 +59,14 @@ | ||
t.equal(osenv.editor(), 'edit') | ||
process.env.EDITOR = '' | ||
delete require.cache[require.resolve('../osenv.js')] | ||
var osenv = require('../osenv.js') | ||
t.equal(osenv.editor(), 'visualedit') | ||
process.env.VISUAL = '' | ||
delete require.cache[require.resolve('../osenv.js')] | ||
var osenv = require('../osenv.js') | ||
t.equal(osenv.editor(), 'vi') | ||
t.end() | ||
}) |
@@ -25,2 +25,4 @@ // only run this test on windows | ||
process.env.PROMPT = '(o_o) $ ' | ||
process.env.EDITOR = 'edit' | ||
process.env.VISUAL = 'visualedit' | ||
@@ -62,3 +64,14 @@ tap.test('basic windows sanity test', function (t) { | ||
t.equal(osenv.editor(), 'edit') | ||
process.env.EDITOR = '' | ||
delete require.cache[require.resolve('../osenv.js')] | ||
var osenv = require('../osenv.js') | ||
t.equal(osenv.editor(), 'visualedit') | ||
process.env.VISUAL = '' | ||
delete require.cache[require.resolve('../osenv.js')] | ||
var osenv = require('../osenv.js') | ||
t.equal(osenv.editor(), 'notepad.exe') | ||
t.end() | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9981
188
59
68