@@ -7,58 +7,12 @@ namespace ts.server {
77 const readline : NodeJS . ReadLine = require ( "readline" ) ;
88 const fs : typeof NodeJS . fs = require ( "fs" ) ;
99
10- // TODO: "net" module not defined in local node.d.ts
11- const net : any = require ( "net" ) ;
12-
1310 const rl = readline . createInterface ( {
1411 input : process . stdin ,
1512 output : process . stdout ,
1613 terminal : false ,
1714 } ) ;
1815
19- // Need to write directly to stdout, else rl.write also causes an input "line" event
20- // See https://github.com/joyent/node/issues/4243
21- let writeHost = ( data : string ) => process . stdout . write ( data ) ;
22-
23- // Stubs for I/O
24- const onInput = ( input : string ) => { return ; } ;
25- const onClose = ( ) => { return ; } ;
26-
27- // Use a socket for comms if defined
28- const tss_debug : string = process . env [ "TSS_DEBUG" ] ;
29- let tcp_port = 0 ;
30- if ( tss_debug ) {
31- tss_debug . split ( " " ) . forEach ( param => {
32- if ( param . indexOf ( "port=" ) === 0 ) {
33- tcp_port = parseInt ( param . substring ( 5 ) ) ;
34- }
35- } ) ;
36- if ( tcp_port ) {
37- net . createServer ( ( socket : any ) => {
38- // Called once a connection is made
39- socket . setEncoding ( "utf8" ) ;
40- // Wire up the I/O handers to the socket
41- writeHost = ( data : string ) => {
42- socket . write ( data ) ;
43- return true ;
44- } ;
45- socket . on ( "data" , ( data : string ) => {
46- // May get multiple requests in one network read
47- if ( data ) {
48- data . trim ( ) . split ( / ( \r \n ) | \n / ) . forEach ( line => onInput ( line ) ) ;
49- }
50- } ) ;
51- socket . on ( "end" , onClose ) ;
52-
53- } ) . listen ( tcp_port ) ;
54- }
55- }
56- if ( ! tcp_port ) {
57- // If not using tcp, wire up the I/O handler to stdin/stdout
58- rl . on ( "line" , ( input : string ) => onInput ( input ) ) ;
59- rl . on ( "close" , ( ) => onClose ( ) ) ;
60- }
61-
6216 class Logger implements ts . server . Logger {
6317 fd = - 1 ;
6418 seq = 0 ;
0 commit comments