consistent-path
is an npm module that makes sure that you get the correct $PATH
value even on GUI apps on OSX. It does not modify the globals and caches the result to avoid unnecessary work.
module.exports = function(): string
module.exports.async = function(): Promise<string>
import {spawnSync} from 'child_process'
import getPath from 'consistent-path'
const assign = Object.assign || require('some-object-assign-polyfill')
const env = assign({}, process.env, {PATH: getPath()})
console.log('$PATH', spawnSync('printenv', {env}))
Differences to atom-community/environment:
- See atom-linter#62
Differences to sindresorhus/fix-path
-
fix-path
modifies globals -
fix-path
has duplication of work when multiple modules use it as there's no caching in place
This project is licensed under the terms of MIT License