Using conemu -new_console switch from node exec

1

ConEmu has a nice feature to use -new_console when launching applications to have them inside a new tab.

When doing this with putty, putty -new_console, it even integrates the putty terminal nicely inside the new tab.

However, when I run a node script, which uses exec('putty -new_console') it opens a new tab, but does not manage to capture the launched putty terminal.

I have read most of the ConEmu wiki trying to find something related to another process being the parent of the launched process, in hopes of finding a solution in that direction, but didn't manage to get it working.

To reproduce, this should be enough:

var exec = require('child_process').exec; exec('putty -new_console');

This piece of node.js code will open a new tab, launch putty, but not capture the terminal window.

David Cumps

Posted 2015-01-19T10:51:57.883

Reputation: 113

Answers

1

Your call does not execute putty.exe directly! Instead it runs cmd.exe with /c switch. If course -new_console will run cmd.exe in new tab. And then putty will not be attached as ChildGui into ConEmu tab because there was no such request!

You need to force your node to run proper command. And that is not a ConEmu related question.

As workaround you may do following call

exec('ConEmu /reuse /cmd putty')

Maximus

Posted 2015-01-19T10:51:57.883

Reputation: 19 395

Thanks Maximus, as always you were awesomely fast to answer :) I expected it to be something with another process being in between, forcing it to do conemu with /reuse fixed it. Thanks – David Cumps – 2015-01-19T18:12:18.407