Nodemon: Code completion and keyup/down don't work in Repl

Created on 20 Aug 2013  Â·  3Comments  Â·  Source: remy/nodemon

Hi, great work, like the Compass "watch" command, this saves a lot of time

Our node app uses a Repl (http://nodejs.org/api/repl.html) prompt that we can issue server commands in. When running under nodemon, the tab completion and keyup/down for previous/next commands don't work anymore, instead the literal char characters are printed on the REPL command line input:

^[[A^[[A^[[B^[[B

This is quite annoying, any chance of fixing that easily?

Most helpful comment

Fixed in the dev release of nodemon - please take a look any give it a test if you have time: npm install nodemon@dev.

Note that for the repl to work, you need to disable the "restartable" feature using a nodemon.json in the current working directory containing at least (or it can be in your home directory):

{
  "restartable": false
}

All 3 comments

I'm not sure it's simple. Certainly I've tried something similar in the
past to no avail.

The issue is that nodemon wraps the node process, so the stdin needs to be
piped in the right way, but that depends entirely on * how * you're reading
stdin...

In not sure there's a clean way of doing it, but if you can provide a
simple test case, then I'll check it in the refractor I'm working on.

– Remy
On 20 Aug 2013 09:48, "Rob Boerman" [email protected] wrote:

Hi, great work, like the Compass "watch" command, this saves a lot of time

Our node app uses a Repl (http://nodejs.org/api/repl.html) prompt that we
can issue server commands in. When running under nodemon, the tab
completion and keyup/down for previous/next commands don't work anymore,
instead the literal char characters are printed on the REPL command line
input:

^[[A^[[A^[[B^[[B

This is quite annoying, any chance of fixing that easily?

—
Reply to this email directly or view it on GitHubhttps://github.com/remy/nodemon/issues/204
.

sure, just run the example below, enter .help or something and then try to hit your 'up' key or type something and try to move the cursor left with your left key. Under normal node there is no problem, under nodemon it just dumps the keycodes. We use this to dump the server into a repl once Express is started.

--- repl.js ---
var repl = require('repl');

// Start Express or something, when it's up, startup the REPL
var rpl = repl.start('REPL >');

rpl.commands['.hello'] = {
help: 'Hello world command.',
action: function() {
console.log('Hello world.');
}
};

--- console output ---
[rob@Macbook Pro(b)] tmp $ nodemon repl.js
3 Sep 08:49:57 - [nodemon] v0.7.10
3 Sep 08:49:57 - [nodemon] to restart at any time, enter rs
3 Sep 08:49:57 - [nodemon] watching: /Users/rob/tmp
3 Sep 08:49:57 - [nodemon] starting node repl.js
REPL >.help
.help
.break Sometimes you get stuck, this gets you out
.clear Break, and also clear the local context
.exit Exit the repl
.hello Hello world command.
.help Show repl options
.load Load JS from a file into the REPL session
.save Save all evaluated commands in this REPL session to a file
REPL >^[[A^[[A^[[A^[[A^[[D^[[D3

Fixed in the dev release of nodemon - please take a look any give it a test if you have time: npm install nodemon@dev.

Note that for the repl to work, you need to disable the "restartable" feature using a nodemon.json in the current working directory containing at least (or it can be in your home directory):

{
  "restartable": false
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

giacomorebonato picture giacomorebonato  Â·  5Comments

fabianMendez picture fabianMendez  Â·  4Comments

jagged3dge picture jagged3dge  Â·  4Comments

jonerer picture jonerer  Â·  4Comments

medoix picture medoix  Â·  4Comments