diff --git a/src/exec-dmenu.js b/src/exec-dmenu.js index 8089cea..c820851 100644 --- a/src/exec-dmenu.js +++ b/src/exec-dmenu.js @@ -1,5 +1,7 @@ const { exec } = require('child_process') +const dmenuPath = process.env.DMENU_PATH || 'dmenu' + module.exports = (...args) => choices => new Promise((resolve, reject) => { let choice = '' @@ -7,8 +9,7 @@ module.exports = (...args) => choices => const error = [] // Use a default of 'dmenu' if not specified in process.env - const dmenu_binary = (typeof dmenu_path === 'undefined') ? 'dmenu' : dmenu_path; - const execCommand = `${dmenu_binary} ${args}` + const execCommand = `${dmenuPath} ${args}` console.debug('$', execCommand) const dmenu = exec(execCommand) dmenu.stdin.write(choices)