10000 Win ansi bug fix by MrRio · Pull Request #26 · MrRio/vtop · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Win ansi bug fix #26

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Win ansi bug fix #26

wants to merge 1 commit into from

Conversation

MrRio
Copy link
Owner
@MrRio MrRio commented Jun 16, 2014

This fixes part of #12

@MrRio
Copy link
Owner Author
MrRio commented Jun 16, 2014

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

@branneman
Copy link

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
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

8000

@branneman
Copy link

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

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
0