Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Implement printing to stderr.
  • Loading branch information
pmurias committed Sep 1, 2015
1 parent 5c0f0ba commit 52c0117
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/vm/js/QAST/Compiler.nqp
Expand Up @@ -509,6 +509,8 @@ class QAST::OperationsJS {
add_simple_op('say', $T_VOID, [$T_STR], :sideffects);
add_simple_op('print', $T_VOID, [$T_STR], :sideffects);

add_simple_op('getstderr', $T_OBJ, [], :sideffects);

add_simple_op('open', $T_OBJ, [$T_STR, $T_STR], :sideffects);

add_simple_op('tellfh', $T_INT, [$T_OBJ], :sideffects);
Expand Down
10 changes: 10 additions & 0 deletions src/vm/js/nqp-runtime/io.js
Expand Up @@ -236,3 +236,13 @@ op.getenvhash = function() {
}
return hash;
};

function Stderr() {
};
Stderr.prototype.printfh = function(msg) {
process.stderr.write(msg);
}

op.getstderr = function() {
return new Stderr();
};

0 comments on commit 52c0117

Please sign in to comment.