3

enter image description hereI want to run commands like vim with node.js. I tried it with require('child_process').exec but the problem is that the output is done with console.log().

Is there a possibility to execute vim within node.js?

Jonas
  • 725
  • 5
  • 23
  • 2
    what exaclty is your problem? you can read the output stream of your child process, if this is what you need – Nick D Apr 21 '16 at 14:11
  • @NickD I have just updated the post. There is an example now. – Jonas Apr 21 '16 at 18:33
  • 1
    have you tried `process.stdout.write();` because `console.log();` adds a newline at the end, and `process.stdout.write()` does not – mugabits Apr 21 '16 at 18:39
  • @jmugz3 Tried it and yes, indeed, at least the last line is now removed but `vim` still does not work and `ls` is still separated with a new line. Also colors of my .bash_profile do not work. – Jonas Apr 21 '16 at 18:51
  • 1
    for the colors, you have to add that to your node environment. Otherwise, it will just use its default, not your default. – mugabits Apr 21 '16 at 18:55
  • 2
    this is a duplicate of [this](http://stackoverflow.com/questions/9122282/how-do-i-open-a-terminal-application-from-node-js). – mugabits Apr 21 '16 at 18:57
  • @jmugz3 thanks for the submission. It is working now :) – Jonas Apr 21 '16 at 19:08

1 Answers1

0

Thanks to @jmugz3 I found out that the question was already asked here. The complete solution can be found there.

Community
  • 1
  • 1
Jonas
  • 725
  • 5
  • 23