mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-04 02:21:47 +00:00
fix: avoid prompt_toolkit complex tempfile bug and prefer nvim first
Setting buffer.tempfile = 'prompt.md' pushed prompt_toolkit into its complex-tempfile path, which creates a temp dir and then calls os.makedirs() on that same path when no subdirectory is present. That raises EEXIST before the editor can launch. Keep prompt_toolkit on the simple tempfile path with .md suffix, and make the editor fallback chain explicit on both surfaces: $VISUAL -> $EDITOR -> nvim -> vim -> vi -> nano.
This commit is contained in:
parent
db7c5735f0
commit
d056b610b7
3 changed files with 15 additions and 12 deletions
|
|
@ -6,7 +6,7 @@ import { delimiter, join } from 'node:path'
|
|||
*
|
||||
* Order of preference:
|
||||
* 1. $VISUAL / $EDITOR (user's explicit choice)
|
||||
* 2. first executable found on $PATH from `vim` → `vi` → `nano`
|
||||
* 2. first executable found on $PATH from `nvim` → `vim` → `vi` → `nano`
|
||||
* 3. literal `'vi'` so spawnSync still has something to try
|
||||
*
|
||||
* Mirrors the override on `input_area.buffer._open_file_in_editor` in cli.py
|
||||
|
|
@ -14,7 +14,7 @@ import { delimiter, join } from 'node:path'
|
|||
* doesn't surprise the user with nano in one and vim in the other.
|
||||
*/
|
||||
export function resolveEditor(env: NodeJS.ProcessEnv = process.env): string {
|
||||
return env.VISUAL || env.EDITOR || findExecutable(env.PATH ?? '', 'vim', 'vi', 'nano') || 'vi'
|
||||
return env.VISUAL || env.EDITOR || findExecutable(env.PATH ?? '', 'nvim', 'vim', 'vi', 'nano') || 'vi'
|
||||
}
|
||||
|
||||
function findExecutable(path: string, ...names: string[]): null | string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue