Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const handleEditorPathInput = async editorFilePath => {
let editorPath;
if (isFile(editorFilePath) && isExecutable(editorFilePath)) {
editorPath = editorFilePath;
} else {
const ans = readline.questionPath("Input editor path: ", {
isFile: true,
});
if (isExecutable(ans)) {
editorPath = ans;
} else {
console.warn(`${ans} is not executable.`);
editorPath = await handleEditorPathInput();
}
}
return editorPath;
};