command line params refactor

This commit is contained in:
Jan Prochazka
2021-04-17 16:38:10 +02:00
parent 1d264ab559
commit c0c1f9d786
12 changed files with 56 additions and 27 deletions

View File

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

View File

@@ -40,7 +40,11 @@ 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', ...process.argv.slice(3)]);
const subprocess = fork(process.argv[1], [
'--start-process',
'databaseConnectionProcess',
...process.argv.slice(3),
]);
const lastClosed = this.closed[`${conid}/${database}`];
const newOpened = {
conid,
@@ -127,7 +131,7 @@ module.exports = {
} else {
existing = await this.ensureOpened(conid, database);
}
return {
status: 'ok',
connectionStatus: existing ? existing.status : null,

View File

@@ -30,7 +30,11 @@ 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', ...process.argv.slice(3)]);
const subprocess = fork(process.argv[1], [
'--start-process',
'serverConnectionProcess',
...process.argv.slice(3),
]);
const newOpened = {
conid,
subprocess,

View File

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