native modules - pass version from electron to API

This commit is contained in:
Jan Prochazka
2021-01-16 20:32:07 +01:00
parent c5e75dfe3e
commit d1aef572bd
11 changed files with 350 additions and 22 deletions

View File

@@ -44,7 +44,7 @@ module.exports = {
raw: true,
},
test(req, res) {
const subprocess = fork(process.argv[1], ['connectProcess']);
const subprocess = fork(process.argv[1], ['connectProcess', ...process.argv.slice(3)]);
subprocess.on('message', (resp) => {
// @ts-ignore
const { msgtype } = resp;

View File

@@ -39,7 +39,7 @@ module.exports = {
const existing = this.opened.find((x) => x.conid == conid && x.database == database);
if (existing) return existing;
const connection = await connections.get({ conid });
const subprocess = fork(process.argv[1], ['databaseConnectionProcess']);
const subprocess = fork(process.argv[1], ['databaseConnectionProcess', ...process.argv.slice(3)]);
const lastClosed = this.closed[`${conid}/${database}`];
const newOpened = {
conid,

View File

@@ -92,7 +92,7 @@ module.exports = {
const pluginNames = fs.readdirSync(pluginsdir());
console.log(`RUNNING SCRIPT ${scriptFile}`);
// const subprocess = fork(scriptFile, ['--checkParent', '--max-old-space-size=8192'], {
const subprocess = fork(scriptFile, ['--checkParent'], {
const subprocess = fork(scriptFile, ['--checkParent', ...process.argv.slice(3)], {
cwd: directory,
stdio: ['ignore', 'pipe', 'pipe', 'ipc'],
env: {

View File

@@ -25,7 +25,7 @@ module.exports = {
const existing = this.opened.find((x) => x.conid == conid);
if (existing) return existing;
const connection = await connections.get({ conid });
const subprocess = fork(process.argv[1], ['serverConnectionProcess']);
const subprocess = fork(process.argv[1], ['serverConnectionProcess', ...process.argv.slice(3)]);
const newOpened = {
conid,
subprocess,

View File

@@ -64,7 +64,7 @@ module.exports = {
async create({ conid, database }) {
const sesid = uuidv1();
const connection = await connections.get({ conid });
const subprocess = fork(process.argv[1], ['sessionProcess']);
const subprocess = fork(process.argv[1], ['sessionProcess', ...process.argv.slice(3)]);
const newOpened = {
conid,
database,

View File

@@ -1,3 +1,7 @@
const msnodesqlv8 = () => require('msnodesqlv8');
module.exports = { msnodesqlv8 };
const argIndex = process.argv.indexOf('--native-modules');
const redirectFile = argIndex > 0 ? process.argv[argIndex + 1] : null;
// @ts-ignore
module.exports = redirectFile ? __non_webpack_require__(redirectFile) : { msnodesqlv8 };

View File

@@ -28,7 +28,7 @@ class DatastoreProxy {
async ensureSubprocess() {
if (!this.subprocess) {
this.subprocess = fork(process.argv[1], ['jslDatastoreProcess']);
this.subprocess = fork(process.argv[1], ['jslDatastoreProcess', ...process.argv.slice(3)]);
// @ts-ignore
this.subprocess.on('message', ({ msgtype, ...message }) => {