2016-03-12 13:50:43 -05:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
cat > test.js << EOF
|
|
|
|
var task = new Task();
|
|
|
|
task.activate();
|
2016-04-16 17:30:52 -04:00
|
|
|
task.execute({name: "child.js", source: File.readFile("child.js")}).then(function() {
|
2016-03-12 13:50:43 -05:00
|
|
|
task.getExports().then(function(exports) {
|
|
|
|
return exports.add(1, 1);
|
|
|
|
}).then(function(sum) {
|
|
|
|
exit(1);
|
|
|
|
}).catch(function(error) {
|
|
|
|
print(error);
|
|
|
|
print("Caught: " + error.message);
|
|
|
|
exit(0);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
EOF
|
|
|
|
|
|
|
|
cat > child.js << EOF
|
|
|
|
exports = {
|
|
|
|
add: function(left, right) {
|
|
|
|
return new Promise(function(resolve, reject) {
|
|
|
|
reject(new Error("oops"));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
EOF
|
|
|
|
|
2016-03-13 09:37:58 -04:00
|
|
|
$TILDEFRIENDS test.js
|