Skip to content

Commit

Permalink
test: use custom userData folder for requestSingleInstanceLock()
Browse files Browse the repository at this point in the history
  • Loading branch information
deermichel committed Mar 31, 2022
1 parent 929fc8b commit 701a76d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions spec/fixtures/api/singleton/main.js
@@ -1,9 +1,17 @@
const { app } = require('electron');
const fs = require('fs');
const path = require('path');

app.whenReady().then(() => {
console.log('started'); // ping parent
});

// non-existing user data folder should not break requestSingleInstanceLock()
// ref: https://github.com/electron/electron/issues/33547
const userDataFolder = path.join(app.getPath('home'), 'electron-userData');
fs.rmSync(userDataFolder, { force: true, recursive: true });
app.setPath('userData', userDataFolder);

const gotTheLock = app.requestSingleInstanceLock();

app.on('second-instance', (event, args, workingDirectory) => {
Expand Down

0 comments on commit 701a76d

Please sign in to comment.