Skip to content

Commit

Permalink
Minor fix for r2pipe.js
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed Sep 20, 2016
1 parent faaac94 commit f3a38a5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions nodejs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,14 +442,18 @@ var r2node = {
fd_in.on('end', function () {
console.error('[-] r2pipe-io is over');
});
/* send initial byte to initialize the r2pipe stream */
/* this thing can change in the future. and should be */
/* enforced to bring better errors to the user */
// fd_out.write('\x00');
function send (obj) {
// console.log ("Send Object To R2",obj);
// console.error ("Send Object To R2",obj);
fd_out.write(JSON.stringify(obj || {}) + '\x00');
}

fd_in.on('data', function (data) {
data = data.slice(0, -1);
var obj_in = JSON.parse(data);
var trimmedData = data.slice(0, -1).toString().trim();
var obj_in = JSON.parse(trimmedData);
if (cb) {
var me = {
'send': send
Expand Down

0 comments on commit f3a38a5

Please sign in to comment.