Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
* file is referencing no longer responds to a heartbeat. Locate the sidecar window corresponding
* to this kernel and shut it down.
*
* @param connPath {string} the filesystem path to the connection JSON file.
*/
function handleDeadKernel(connPath) {
console.log("Connection " + connPath + " is no longer present.");
if (liveSidecars.has(connPath)) {
console.log("Closing the corresponding sidecar.");
liveSidecars.get(connPath).close();
liveSidecars.delete(connPath);
}
}
var kw = new RuntimeWatch(updateKernel, jp.paths.runtime[0]);
// This method will be called when Electron has done every
// initialization and is ready for creating browser windows.
app.on('ready', function() {
globalShortcut.register('Alt+CmdOrCtrl+I', function () {
var win = BrowserWindow.getFocusedWindow();
if (win) {
win.toggleDevTools();
}
});
globalShortcut.register('CmdOrCtrl+R', function () {
var win = BrowserWindow.getFocusedWindow();
if (win) {
function findAll() {
return jp.dataDirs({ withSysPrefix: true }).then(dirs => {
return Promise.all(dirs
// get kernel infos for each directory and ignore errors
.map(dir => getKernelInfos(path.join(dir, 'kernels')).catch(() => {}))
).then(extractKernelResources)
});
}
mergeMap(() =>
// Create all the directories we need in parallel
forkJoin(
// Ensure the runtime Dir is setup for kernels
mkdirpObservable(jupyterPaths.runtimeDir()),
// Ensure the config directory is all set up
mkdirpObservable(jupyterConfigDir)
)
),
function find(kernelName) {
return jp.dataDirs({ withSysPrefix: true }).then(dirs => {
const kernelInfos = dirs.map(dir => ({
name: kernelName,
resourceDir: path.join(dir, 'kernels', kernelName),
}))
return extractKernelResources(kernelInfos);
}).then(kernelResource => kernelResource[kernelName])
}