Inquirer.js icon indicating copy to clipboard operation
Inquirer.js copied to clipboard

Editor type does not wait for file to close when using editors other than vim

Open DanielOrtel opened this issue 3 years ago • 3 comments

When using, for example, subl as the default editor of the system, the command does not wait for the file to close, instead it just ends, therefore no answers are passed to the command.

Repro:

import inquirer from 'inquirer';

inquirer
  .prompt([
    {
      type: 'editor',
      name: 'theme',
      message: 'What do you want to do?',
      waitUserInput: true, // <-- does not do anything here
      postfix: 'json' // <-- fyi, this one doesn't work either, but there's already an open issue
    },
  ])
  .then((answers) => {
    console.log(JSON.stringify(answers, null, '  '));
  });

node: v12.22.1 OS: macOS Monterey 12.4

DanielOrtel avatar Aug 11 '22 14:08 DanielOrtel

This might be an issue with the underlying modules handling external editors: https://github.com/mrkmg/node-external-editor

SBoudrias avatar Aug 15 '22 12:08 SBoudrias

I'm experiencing an issue, similar to others (#985), where the prompt doesn't wait for the external editor to close the file.

This doesn't impact editors running within the terminal e.g. nano, or vi, vim, only external editors like subl or code.

gfargo avatar Jul 09 '23 16:07 gfargo

I'm experiencing an issue, similar to others (#985), where the prompt doesn't wait for the external editor to close the file.

This doesn't impact editors running within the terminal e.g. nano, or vi, vim, only external editors like subl or code.

See #985. For Sublime Text, you can also use subl -w or subl --wait.

mensah-j avatar May 14 '24 02:05 mensah-j