Skip to content

Commit

Permalink
Make sure browser closes
Browse files Browse the repository at this point in the history
  • Loading branch information
ebidel committed Oct 8, 2017
1 parent 27a8fda commit a11abd8
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions backend/server.js
Expand Up @@ -83,6 +83,11 @@ function runCodeInSandbox(code) {
// Wrap user code in an async function so async/await can be used out of the box.
(async() => {
${code} // user's code
// Close the chrome even if user doesn't. This assumes they've used a var
// called "browser".
if (typeof browser !== 'undefined') {
await browser.close();
}
return ${buildResponse.toString()}(fileCreated, log); // inline function, call it
})();
`;
Expand Down

0 comments on commit a11abd8

Please sign in to comment.