Skip to content

Commit 72e39a0

Browse files
committed
initial fix for debugging python
1 parent e162c19 commit 72e39a0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

helpers/python/debug_helper.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ var spawn = require('child_process').spawn,
22
exec = require('child_process').exec,
33
net = require('net'),
44
path = require('path'),
5+
ws_helper = require('../websocket_helper'),
56
debug_program, debug_client,
67
client_connected = false,
78
HOST = '127.0.0.1',
@@ -45,7 +46,7 @@ exports.start_debug = function start_debug(file, socket) {
4546

4647
debug_program.stderr.on('data', function(data) {
4748
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});
4950
});
5051

5152
debug_program.on('error', function(data) {
@@ -82,6 +83,7 @@ function connect_client(file, socket) {
8283
debug_client = new net.Socket();
8384
debug_client.connect(PORT, HOST, function() {
8485
socket.emit('debug-client-connected');
86+
ws_helper.send_message(socket, 'debug-client-connected', "");
8587
client_connected = true;
8688
console.log('connected to python debugger: ' + HOST + ':' + PORT);
8789
console.log(file_path);
@@ -95,7 +97,7 @@ function connect_client(file, socket) {
9597
var temp_buff = buffer.split('\n');
9698
for (var i=0; i<temp_buff.length-1; i++) {
9799
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]));
99101
}
100102

101103
buffer = temp_buff.slice(temp_buff.length);

public/javascripts/editor.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,7 @@
232232

233233
occEditor.init_events = function(editor) {
234234
var reconnect_attempts = 0;
235+
var markerId;
235236

236237
$(window).bind("beforeunload",function(event) {
237238
return "Please confirm that you would like to leave the editor.";
@@ -421,7 +422,7 @@
421422
move_file_callback(data);
422423
break;
423424
case 'debug-file-response':
424-
move_file_callback(data);
425+
debug_file_response(data);
425426
break;
426427
}
427428

@@ -1089,7 +1090,6 @@
10891090
event.preventDefault();
10901091

10911092
var file = $('.file-open').data('file');
1092-
var markerId;
10931093

10941094
function is_link_active($link) {
10951095
return !$link.hasClass('debug-link-disabled');
@@ -1517,9 +1517,10 @@
15171517
$('#editor-output').css('height', '325px');
15181518
$('.dragbar').show();
15191519
$('#editor').css('bottom', '328px');
1520-
term.element.style.padding = 7;
15211520
editor.resize();
1522-
window.term.fit();
1521+
if (window.term) {
1522+
window.term.fit();
1523+
}
15231524
}
15241525
};
15251526

0 commit comments

Comments
 (0)