Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat: add tmpdir option
  • Loading branch information
hyperz111 committed Feb 15, 2026
commit 09747c1c15e40ce0170183e180652c97afed3f5b
3 changes: 2 additions & 1 deletion packages/core/src/prompts/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Prompt, { type PromptOptions } from './prompt.js';
export interface EditorOptions extends PromptOptions<string, EditorPrompt> {
exec?: string;
postfix?: string;
tmpdir?: string;
}

export default class EditorPrompt extends Prompt<string> {
Expand All @@ -25,7 +26,7 @@ export default class EditorPrompt extends Prompt<string> {

this.exec =
opts.exec ?? process.env.EDITOR ?? (process.platform === 'win32' ? 'notepad' : 'nano');
this.path = join(tmpdir(), `ce-${randomUUID()}${opts.postfix ?? ''}`);
this.path = join(opts.tmpdir ?? tmpdir(), `ce-${randomUUID()}${opts.postfix ?? ''}`);
writeFileSync(this.path, this.value as string);

this.on('key', (_char, key) => {
Expand Down