Created
November 11, 2016 18:22
-
-
Save opichals/88e48fefa92b6d09f7afefd392a85233 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (typeof console === 'undefined') { | |
// also see | |
// | |
// https://blogs.oracle.com/nashorn/entry/setinterval_and_settimeout_javascript_functions | |
// https://gist.github.com/kayhadrin/4bf141103420b79126e434dfcf6d4826 | |
// | |
// https://avatar-js.java.net/index.html | |
// https://java.net/projects/avatar-js/sources | |
var console = {}; | |
console.debug = print; | |
console.log = print; | |
console.warn = print; | |
console.error = print; | |
var global = this; | |
var window = this; | |
process = { | |
env: new JSAdapter({ | |
__get__ : function (name) { | |
return java.lang.System.getenv(name); | |
}, | |
__has__ : function (name) { | |
return java.lang.System.getenv().containsKey(name); | |
}, | |
__getIds__ : function() { | |
return java.lang.System.getenv().keySet().toArray(); | |
}, | |
__delete__ : function(name) { | |
println("can't delete env item"); | |
}, | |
__put__ : function (name, value) { | |
println("can't change env item"); | |
}, | |
toJSON: function() { | |
return java.lang.System.getenv().toString(); | |
}, | |
toString: function() { | |
return java.lang.System.getenv().toString(); | |
} | |
}), | |
argv: [ | |
'jjs', | |
'this', | |
].concat(arguments) | |
}; | |
} | |
console.log('args', Object.keys(process.env)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment