@@ -2,6 +2,7 @@ var spawn = require('child_process').spawn,
2
2
exec = require ( 'child_process' ) . exec ,
3
3
net = require ( 'net' ) ,
4
4
path = require ( 'path' ) ,
5
+ ws_helper = require ( '../websocket_helper' ) ,
5
6
debug_program , debug_client ,
6
7
client_connected = false ,
7
8
HOST = '127.0.0.1' ,
@@ -45,7 +46,7 @@ exports.start_debug = function start_debug(file, socket) {
45
46
46
47
debug_program . stderr . on ( 'data' , function ( data ) {
47
48
console . log ( data . toString ( ) ) ;
48
- socket . emit ( 'debug-error' , { file : file , error : data } ) ;
49
+ ws_helper . send_message ( socket , 'debug-error' , { file : file , error : data } ) ;
49
50
} ) ;
50
51
51
52
debug_program . on ( 'error' , function ( data ) {
@@ -82,6 +83,7 @@ function connect_client(file, socket) {
82
83
debug_client = new net . Socket ( ) ;
83
84
debug_client . connect ( PORT , HOST , function ( ) {
84
85
socket . emit ( 'debug-client-connected' ) ;
86
+ ws_helper . send_message ( socket , 'debug-client-connected' , "" ) ;
85
87
client_connected = true ;
86
88
console . log ( 'connected to python debugger: ' + HOST + ':' + PORT ) ;
87
89
console . log ( file_path ) ;
@@ -95,7 +97,7 @@ function connect_client(file, socket) {
95
97
var temp_buff = buffer . split ( '\n' ) ;
96
98
for ( var i = 0 ; i < temp_buff . length - 1 ; i ++ ) {
97
99
console . log ( JSON . parse ( temp_buff [ i ] ) ) ;
98
- socket . emit ( 'debug-file-response' , JSON . parse ( temp_buff [ i ] ) ) ;
100
+ ws_helper . send_message ( socket , 'debug-file-response' , JSON . parse ( temp_buff [ i ] ) ) ;
99
101
}
100
102
101
103
buffer = temp_buff . slice ( temp_buff . length ) ;
0 commit comments