vorpal icon indicating copy to clipboard operation
vorpal copied to clipboard

Hitting CTRL+C while in Inquirer prompt breaks everything

Open scotthovestadt opened this issue 10 years ago • 16 comments

The output looks like this:

(^C again to quit)
function (str) {
  if (str === undefined) {
    return this._delimiter;
  }
  this._delimiter = String(str).trim() + ' ';
  if (this.isLocal()) {
    this.parent.ui.refresh();
  } else {
    this.parent._send('vantage-delimiter-downstream', 'downstream', {value: str, sessionId: this.id});
  }
  return this;
}
_

You can still type but nothing happens. Only way to recover is hitting CTRL+C again.

scotthovestadt avatar Nov 01 '15 22:11 scotthovestadt

Yikes! Okay will check out.

dthree avatar Nov 02 '15 02:11 dthree

Hi Team,

Is above issue solved?

hiteshbal91 avatar Dec 11 '15 15:12 hiteshbal91

Issue is still present.

scotthovestadt avatar Dec 11 '15 16:12 scotthovestadt

Hey Scott - sorry I haven't been very active recently. A lot of things are changing in life right now, so I haven't had too much time for OSS. Hope to get back fairly soon and close all these issues.

Otherwise, all your help's been very appreciated. I wouldn't mind adding you to the Vorpal team, if you're down with that.

dthree avatar Dec 14 '15 18:12 dthree

Don't worry about it; that's how open source is sometimes. You contribute when you can, and mostly when you need it yourself. ;)

I would appreciate the abilities to accept pull requests and deploy code to npm if possible.

scotthovestadt avatar Dec 14 '15 18:12 scotthovestadt

Okay Scott, giving you access now.

Feel free to make any patches you need, obviously add tests as you go. Just check with me before committing anything that alters the API, or any breaking changes.

Thanks for all your help!

dthree avatar Dec 18 '15 04:12 dthree

Okay this should be good now. Can you please try it? v1.5.2

dthree avatar Dec 24 '15 21:12 dthree

No luck.

C17PR768G8WP:cli shovestadt$ cli
cli:
function (str) {
  if (str === undefined) {
    return this._delimiter;
  }
  this._delimiter = String(str).trim() + ' ';
  if (this.isLocal()) {
    this.parent.ui.refresh();
  } else {
    this.parent._send('vantage-delimiter-downstream', 'downstream', {value: str, sessionId: this.id});
  }
  return this;
}
function (str) {
  if (str === undefined) {
    return this._delimiter;
  }
  this._delimiter = String(str).trim() + ' ';
  if (this.isLocal()) {
    this.parent.ui.refresh();
  } else {
    this.parent._send('vantage-delimiter-downstream', 'downstream', {value: str, sessionId: this.id});
  }
  return this;
Username: test
Password:

^C/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:75
    throw e;
    ^

TypeError: Cannot read property 'removeListener' of null
    at [object Object].UI.close (/usr/local/lib/node_modules/cli/node_modules/inquirer/lib/ui/baseUI.js:45:10)
    at [object Object].PromptUI.onCompletion (/usr/local/lib/node_modules/cli/node_modules/inquirer/lib/ui/prompt.js:54:8)
    at AnonymousObserver.Rx.AnonymousObserver.AnonymousObserver.completed (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:1550:12)
    at AnonymousObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:1489:14)
    at Subject.Rx.Subject.addProperties.onCompleted (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:5871:19)
    at Subject.tryCatcher (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:63:31)
    at AutoDetachObserverPrototype.completed (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:5796:56)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:1489:14)
    at AutoDetachObserver.tryCatcher (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:63:31)
    at AutoDetachObserverPrototype.completed (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:5796:56)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:1489:14)
    at InnerObserver.onCompleted (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:2966:65)
    at InnerObserver.tryCatcher (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:63:31)
    at AutoDetachObserverPrototype.completed (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:5796:56)
    at AutoDetachObserver.Rx.internals.AbstractObserver.AbstractObserver.onCompleted (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:1489:14)
    at AutoDetachObserver.tryCatcher (/usr/local/lib/node_modules/cli/node_modules/rx-lite/rx.lite.js:63:31)

scotthovestadt avatar Dec 24 '15 22:12 scotthovestadt

Can you show me the code with the inquirer prompt?

dthree avatar Dec 24 '15 22:12 dthree

// Login command only available in CLI, requires user input.
vorpal
  .command('login [userKey] [userSecret]')
  .description('Set user key and user secret key.')
  .action(function(args, callback) {
    this.prompt([
      {
        type: 'input',
        name: 'userKey',
        message: 'User key: ',
        validate: (input) => {
          return input.length > 10;
        }
      },
      {
        type: 'input',
        name: 'userSecret',
        message: 'User secret key: ',
        validate: (input) => {
          return input.length > 20;
        }
      }
    ], (answers) => {
      self.userKey = self.commands.userKey = answers.userKey;
      self.userSecret = self.commands.userSecret = answers.userSecret;
      callback();
    });
  });
}

scotthovestadt avatar Dec 24 '15 22:12 scotthovestadt

Thanks. Checking it out.

dthree avatar Dec 24 '15 22:12 dthree

Oh - haha - it only breaks on multi-inputs. Looks like the Inquirer cancellation doesn't handle an array of inputs.

dthree avatar Dec 24 '15 22:12 dthree

Ugh. Cancelling inquirer prompts is literally the messiest part of my code, because Inquirer doesn't support command cancellation, so I have to hack it. This is going to take longer to fix.

dthree avatar Dec 24 '15 22:12 dthree

Running into this as well... where's the like button? :+1:

shayne avatar Feb 09 '16 23:02 shayne

Got it. This one's... gnarly. Will try to work on it some more soon.

dthree avatar Feb 09 '16 23:02 dthree

This problem still exists and breaks the REPL

exactmultiple3425 avatar Feb 09 '18 09:02 exactmultiple3425