Skip to content
This repository has been archived by the owner on Feb 25, 2021. It is now read-only.

Commit

Permalink
Merge pull request #42 from 86chenjie/master
Browse files Browse the repository at this point in the history
fix exception
  • Loading branch information
bcoe committed Nov 5, 2014
2 parents 0c97209 + 6f1460a commit 483217f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/script.js
Expand Up @@ -111,7 +111,7 @@ Script.prototype._parseChunk = function(data) {
try {
if (data.toString() !== 'undefined') {
output = JSON.parse(data);
if (output.error) {
if (output !== null && output.error) {
error = new Error(output.error.message);
error.stack = output.error.stack;
output = null;
Expand Down
18 changes: 18 additions & 0 deletions test/sandcastle-test.js
Expand Up @@ -84,6 +84,24 @@ describe('SandCastle', function () {

script.run();
});

it('should able to exit(null)', function (finished) {
var sandcastle = new SandCastle();

var script = sandcastle.createScript("\
exports.main = function() {\
exit(null);\
}\
");

script.on('exit', function (err, result) {
sandcastle.kill();
equal(result,null);
finished();
});

script.run();
});

it('should provide an API', function (finished) {
var sandcastle = new SandCastle({
Expand Down

0 comments on commit 483217f

Please sign in to comment.