Skip to content

Commit dd02e8e

Browse files
quark-zjufacebook-github-bot
authored andcommitted
isl-server: tell sapling CLI to not spawn an editor
Summary: See also D71572659. ISL wants sapling CLI commands to be non-interactive but editors like `vim` can still block forever. Let's explicitly set the editor to a non-blocking executable to avoid surprises. ISL shouldn't normally use the interactive editor, but it's good to be defensive so if we accidentally trigger the editor, it won't hang forever. I choose `HGEDITOR` because it has the highest priority that overrides other configs like `ui.editor` and `EDITOR`. Reviewed By: muirdm Differential Revision: D71653280 fbshipit-source-id: 00e8cc6aeded2d4910bf99c657212d5eb61e863e
1 parent e43eb9c commit dd02e8e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

addons/isl-server/src/commands.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,9 @@ export function getExecParams(
193193
if (EXCLUDE_FROM_BLACKBOX_COMMANDS.has(commandName)) {
194194
args.push('--config', 'extensions.blackbox=!');
195195
}
196+
// The command should be non-interactive, so do not even attempt to run an
197+
// (interactive) editor.
198+
const editor = os.platform() === 'win32' ? 'exit /b 1' : 'false';
196199
const newEnv = {
197200
...options_?.env,
198201
...env,
@@ -208,7 +211,7 @@ export function getExecParams(
208211
EDITOR: undefined,
209212
VISUAL: undefined,
210213
HGUSER: undefined,
211-
HGEDITOR: undefined,
214+
HGEDITOR: editor,
212215
} as unknown as NodeJS.ProcessEnv;
213216
let langEnv = newEnv.LANG ?? process.env.LANG;
214217
if (langEnv === undefined || !langEnv.toUpperCase().endsWith('UTF-8')) {

0 commit comments

Comments
 (0)