git ssb

0+

cel-desktop / ssb-pkg



Commit 999e6c5d97246e80be3475a0418e31ab178cf9c3

Handle dylib native modules

cel committed on 5/11/2020, 4:08:12 PM
Parent: 65191f9a9664f013ebe726bb95a1a54b086e1bd5

Files changed

prelude/bootstrap.jschanged
prelude/bootstrap.jsView
@@ -1600,9 +1600,9 @@
16001600 }
16011601 args[1] = tmpModulePath;
16021602 }
16031603
1604- const unknownModuleErrorRegex = /([^:]+): cannot open shared object file: No such file or directory/;
1604 + const unknownModuleErrorRegex = /([^:]+): cannot open shared object file: No such file or directory|Library not loaded: @loader_path\/(\S+)/;
16051605 const tryImporting = function (previousErrorMessage) {
16061606 try {
16071607 const res = ancestor.dlopen.apply(process, args);
16081608 return res;
@@ -1614,9 +1614,10 @@
16141614 if (e.message.match(unknownModuleErrorRegex)) {
16151615 // some modules are packaged with dynamic linking and needs to open other files that should be in
16161616 // the same directory, in this case, we write this file in the same /tmp directory and try to
16171617 // import the module again
1618- const moduleName = e.message.match(unknownModuleErrorRegex)[1];
1618 + const m = e.message.match(unknownModuleErrorRegex)
1619 + const moduleName = m[1] || m[2];
16191620 const modulePath = `${moduleDirname}/${moduleName}`;
16201621 const moduleContent = fs.readFileSync(modulePath);
16211622 const moduleBaseName = require('path').basename(modulePath);
16221623 const tmpModulePath = `${require('os').tmpdir()}/${moduleBaseName}`;

Built with git-ssb-web