Skip to content

Commit

Permalink
Add forkAndRun to interactive compute sessions. Closes #1921
Browse files Browse the repository at this point in the history
  • Loading branch information
brollb committed Sep 28, 2020
1 parent c6553e5 commit 28ceb1e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/common/compute/interactive/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,18 @@ define([
}
}

async forkAndRun(fn) {
const session = this.fork();
try {
const result = await fn(session);
session.close();
return result;
} catch (err) {
session.close();
throw err;
}
}

close() {
this.channel.onClientExit(this.id);
}
Expand Down

0 comments on commit 28ceb1e

Please sign in to comment.