HEADS-project / heads_ide

Home Page:http://heads-project.eu

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different output for JavaScript HelloWorld

vladimirc opened this issue · comments

When executing examples from Tutorials the JavaScript outputs contain extra new line for each output, hence producing different output comparing to C or Java code execution.

ThingML print is aligned on Java print. The behavior of the Java println can be achieved by appending \n. At least it works in the generated Java and C code. In node.js however, the default (and only?) behavior or console.log is basically a println, and we cannot just "print a la Java". So this issue seems unsolvable in general (though it might be possible to hack something (e.g removing \n at the end of the string, since console.log will add it anyway)).

console.log = function(d) {
  process.stdout.write(d + '\n');
};

See https://nodejs.org/api/process.html#process_process_stdout