Skip to content

Win ansi bug fix#26

Open
MrRio wants to merge 1 commit intomasterfrom
bugfix-win-ansi
Open

Win ansi bug fix#26
MrRio wants to merge 1 commit intomasterfrom
bugfix-win-ansi

Conversation

@MrRio
Copy link
Copy Markdown
Owner

@MrRio MrRio commented Jun 16, 2014

This fixes part of #12

@MrRio
Copy link
Copy Markdown
Owner Author

MrRio commented Jun 16, 2014

Thanks for your help on this @branneman - could you check this branch?

@branneman
Copy link
Copy Markdown

I cloned the bugfix-win-ansi branch, and ran node app inside the directory.

I think your fix does not solve the problem somehow. And I'm starting to wonder if it's actually possible from inside a node application. Since it's a terminal (or environment?) setting maybe it's not mutable from inside node.

Here's how it looks with SET TERM=windows-ansi:
vtop-win-ansi

And here's how it looks with SET TERM=cygwin or SET TERM=dumb:
vtop-cygwin

So it basically only works when I manually set my TERM variable correctly. Which is the same behaviour as before.

But a more interesting question: what is the default value of the TERM variable? Maybe our machines are somehow in a weird state of configuration, and the default should actually be windows-ansi. Hmm.. more food for thought.

@MrRio
Copy link
Copy Markdown
Owner Author

MrRio commented Jun 16, 2014

I think the default value is 'dumb'. I had the same problem on OSX with users having the TERM set to xterm-color instead of xterm-256color

https://github.com/MrRio/vtop/blob/master/bin/vtop.js#L3

@branneman
Copy link
Copy Markdown

Ah! You've got a shell file which kicks off the app.js - that's a good thing because adding Windows-specific code there maybe the option. But #!/bin/sh is of course not supported, so maybe we should try to find the windows alternative?

@branneman
Copy link
Copy Markdown

Idea: you could also replace the shell file with a node.js file, which spawns a new process, maybe like this:

var spawn = require('child_process').spawn;

// Force platform-specific terminal
var env = {};
if (process.platform === 'darwin') {
  env.TERM = 'xterm-256color';
} else if (process.platform === 'win32') {
  env.TERM = 'windows-ansi';
}

spawn(process.execPath, ['app.js'], {
  env: env,
  stdio: [process.stdin, process.stdout, process.stderr]
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants