From c95ca509f351892f1bae92813914c1bee80fc3e0 Mon Sep 17 00:00:00 2001 From: James Hall Date: Sat, 30 Jul 2016 18:10:01 +0100 Subject: [PATCH] Fallback to nano if no editor is set (#517) * Fallback to nano if no editor is set * Add notepad fallback for windows * Remove padding * Use constant instead of var --- lib/actions/ui.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/actions/ui.js b/lib/actions/ui.js index d9bca1bf..0ca2b0a5 100644 --- a/lib/actions/ui.js +++ b/lib/actions/ui.js @@ -137,6 +137,7 @@ export function moveTo (i) { } export function showPreferences () { + const editorFallback = process.platform === 'win32' ? 'notepad' : 'nano'; return (dispatch, getState) => { dispatch({ type: UI_SHOW_PREFERENCES, @@ -150,7 +151,7 @@ export function showPreferences () { // Leading space prevents command to be store in shell history [' echo Attempting to open ~/.hyperterm.js with your \$EDITOR', // eslint-disable-line no-useless-escape ' echo If it fails, open it manually with your favorite editor!', - ' bash -c "exec env $EDITOR ~/.hyperterm.js"', + ' bash -c "exec env ${EDITOR:=' + editorFallback + '} ~/.hyperterm.js"', '' ].join('\n') ));