Simplify readline setup for Windows users

This commit is contained in:
Andrew Stewart 2013-11-11 07:54:51 -05:00
parent 19929842a2
commit 31bfa85fa8
2 changed files with 4 additions and 6 deletions

7
dist/cylon.js vendored
View File

@ -9,7 +9,7 @@
(function() { (function() {
'use strict'; 'use strict';
var Cylon, readLine, var Cylon,
__slice = [].slice, __slice = [].slice,
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; }; __bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
@ -19,8 +19,6 @@
require('./api'); require('./api');
readLine = require("readline");
Logger.setup(); Logger.setup();
Cylon = (function() { Cylon = (function() {
@ -54,9 +52,10 @@
function Master() { function Master() {
this.robot = __bind(this.robot, this); this.robot = __bind(this.robot, this);
var rl; var readLine, rl;
this.self = this; this.self = this;
if (process.platform === "win32") { if (process.platform === "win32") {
readLine = require("readline");
rl = readLine.createInterface({ rl = readLine.createInterface({
input: process.stdin, input: process.stdin,
output: process.stdout output: process.stdout

View File

@ -12,8 +12,6 @@ require('./utils')
require('./logger') require('./logger')
require('./api') require('./api')
readLine = require "readline"
Logger.setup() Logger.setup()
# Cylon is the global namespace for the project, and also in charge of # Cylon is the global namespace for the project, and also in charge of
@ -41,6 +39,7 @@ class Cylon
constructor: -> constructor: ->
@self = this @self = this
if process.platform is "win32" if process.platform is "win32"
readLine = require "readline"
rl = readLine.createInterface rl = readLine.createInterface
input: process.stdin input: process.stdin
output: process.stdout output: process.stdout