Skip to content
9 changes: 8 additions & 1 deletion src/colony/lua/colony-init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ end

-- arguments objects

function js_arguments (...)
function js_arguments (strict, callee, ...)
local a, len = {}, select('#', ...)
for i=1,len do
local val, _ = select(i, ...)
Expand All @@ -515,6 +515,13 @@ function js_arguments (...)

local obj = global._obj(a);
obj.length = len
if strict then
js_define_getter(obj, 'callee', function (this)
error(js_new(global.TypeError, '\'caller\', \'callee\', and \'arguments\' properties may not be accessed on strict mode functions or the arguments objects for calls to them'))
end)
else
obj.callee = callee
end
get_unique_metatable(obj).arguments = true
return obj
end
Expand Down
4 changes: 2 additions & 2 deletions src/colony/lua/preload.lua
Original file line number Diff line number Diff line change
Expand Up @@ -174,12 +174,12 @@ do

colony.global.process.stdout = colony.js_new(Writable)
colony.global.process.stdout._write = function (this, chunk, encoding, callback)
tm.log(10, chunk)
tm.log(30, chunk)
callback()
end
colony.global.process.stderr = colony.js_new(Writable)
colony.global.process.stderr._write = function (this, chunk, encoding, callback)
tm.log(13, chunk)
tm.log(31, chunk)
callback()
end

Expand Down
8 changes: 7 additions & 1 deletion src/tm_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
#include <unistd.h>
void tm_log(char level, const char* string, unsigned length) {
char linebreak = '\n';
if (level != 13) {
if (level == 30) {
// raw stdout
(void) fwrite(string, 1, length, stdout);
} else if (level == 31) {
// raw stderr
(void) fwrite(string, 1, length, stderr);
} else if (level != 13) {
int r = fwrite(string, 1, length, stdout);
r = fwrite(&linebreak, 1, 1, stdout);
(void) r;
Expand Down
36 changes: 36 additions & 0 deletions test/issues/issue-runtime-573.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
var tap = require('../tap');

tap.count(1);

iCalled();

function iCalled() { callMeMaybe(); }
function callMeMaybe() {
tap.ok(arguments.callee== callMeMaybe,'function callee');
}

/*
var splunkjs = require('splunk-sdk');

setImmediate(function start() {
var service = new splunkjs.Service({
username: "admin",
password: "changeme",
host:"192.168.20.106",
port:"8089"}
);

service.login(function(err, success) {
if (err) {
throw err;
}

console.log("Login was successful: " + success);
service.jobs().fetch(function(err, jobs) {
var jobList = jobs.list();
for(var i = 0; i < jobList.length; i++) {
console.log("Job " + i + ": " + jobList[i].sid);
}
});
});
});*/