FAQ
I'm trying to spawn a vim process from within a node.js CLI script.
It kinda works piping stdin, stdout and stderr between parent and child
processes, but there are some bugs:
1. I get a couple of warnings like this:
Vim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal
2. Backspace doesn't work as expected and just types '^?' instead.
3. vim window size is smaller than the actual terminal window.

Here's the code: https://gist.github.com/2180730

I saw a couple of solutions using 'process.binding("stdio")' or
using customFds, but they don't seem to work (or encouraged) with
node v0.6.14.

And suggestions/ideas are much appreciated!

--
Job Board: http://jobs.nodejs.org/
Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Search Discussions

  • Ben Noordhuis at Mar 26, 2012 at 12:20 pm

    On Mon, Mar 26, 2012 at 09:50, George Miroshnykov wrote:
    I'm trying to spawn a vim process from within a node.js CLI script.
    It kinda works piping stdin, stdout and stderr between parent and child
    processes, but there are some bugs:
    1. I get a couple of warnings like this:
    Vim: Warning: Output is not to a terminal
    Vim: Warning: Input is not from a terminal
    2. Backspace doesn't work as expected and just types '^?' instead.
    3. vim window size is smaller than the actual terminal window.

    Here's the code: https://gist.github.com/2180730

    I saw a couple of solutions using 'process.binding("stdio")' or
    using customFds, but they don't seem to work (or encouraged) with
    node v0.6.14.

    And suggestions/ideas are much appreciated!
    customFds is your best bet. This should work:

    node -e 'require("child_process").spawn("vim", [], {customFds:[0,1,2]})'

    --
    Job Board: http://jobs.nodejs.org/
    Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    You received this message because you are subscribed to the Google
    Groups "nodejs" group.
    To post to this group, send email to [email protected]
    To unsubscribe from this group, send email to
    [email protected]
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en
  • George Miroshnykov at Mar 27, 2012 at 7:49 am
    Wow, that was easy, thanks a lot!
    I ended up using process.stdin.fd, process.stdout.fd and process.stderr.fd
    instead of 0, 1 and 2 just to avoid magic numbers.
    On Monday, March 26, 2012 3:20:27 PM UTC+3, Ben Noordhuis wrote:

    On Mon, Mar 26, 2012 at 09:50, George Miroshnykov
    wrote:
    I'm trying to spawn a vim process from within a node.js CLI script.
    It kinda works piping stdin, stdout and stderr between parent and child
    processes, but there are some bugs:
    1. I get a couple of warnings like this:
    Vim: Warning: Output is not to a terminal
    Vim: Warning: Input is not from a terminal
    2. Backspace doesn't work as expected and just types '^?' instead.
    3. vim window size is smaller than the actual terminal window.

    Here's the code: https://gist.github.com/2180730

    I saw a couple of solutions using 'process.binding("stdio")' or
    using customFds, but they don't seem to work (or encouraged) with
    node v0.6.14.

    And suggestions/ideas are much appreciated!
    customFds is your best bet. This should work:

    node -e 'require("child_process").spawn("vim", [], {customFds:[0,1,2]})'
    --
    Job Board: http://jobs.nodejs.org/
    Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
    You received this message because you are subscribed to the Google
    Groups "nodejs" group.
    To post to this group, send email to [email protected]
    To unsubscribe from this group, send email to
    [email protected]
    For more options, visit this group at
    http://groups.google.com/group/nodejs?hl=en?hl=en

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupnodejs @
categoriesnodejs
postedMar 26, '12 at 7:52a
activeMar 27, '12 at 7:49a
posts3
users2
websitenodejs.org
irc#node.js

People

Translate

site design / logo © 2023 Grokbase