forked from cory/tildefriends
Cory McWilliams
7a16a1d65c
git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3161 ed5197a5-7fde-0310-b194-c3ffbd925b24
30 lines
512 B
Bash
Executable File
30 lines
512 B
Bash
Executable File
#!/bin/bash
|
|
|
|
cat > test.js << EOF
|
|
var task = new Task();
|
|
task.activate();
|
|
task.execute("child.js").then(function() {
|
|
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
|
|
|
|
$TILDEFRIENDS test.js
|