diff --git a/gui/standalone-tests.ts b/gui/standalone-tests.ts index c9480aee7851..30584cc7a15f 100644 --- a/gui/standalone-tests.ts +++ b/gui/standalone-tests.ts @@ -37,10 +37,16 @@ function extract() { function createSealessNode() { const nodeBin = path.join(tmpDir, 'node'); + fs.copyFileSync(process.argv[0], nodeBin); + // Find and disable SEA fuse in node binary const fuseString = 'NODE_SEA_FUSE_' + 'fce680ab2cc467b6e072b8b5df1996b2:'; - let buf = fs.readFileSync(process.argv[0]); + if (process.platform === 'darwin') { + child_process.spawnSync('/usr/bin/codesign', ['--remove-signature', nodeBin]); + } + + let buf = fs.readFileSync(nodeBin); const fuseIndex = buf.indexOf(fuseString); if (fuseIndex !== -1) { @@ -53,6 +59,10 @@ function createSealessNode() { } } + if (process.platform === 'darwin') { + child_process.spawnSync('/usr/bin/codesign', ['--sign', '-', nodeBin]); + } + return nodeBin; }