From 68fc212d4b9de033d5eb2c7eaf7646a6cc35b2ba Mon Sep 17 00:00:00 2001 From: Penelope Gomez / Pogmommy Date: Tue, 7 Feb 2023 21:58:23 -0700 Subject: [PATCH 1/2] Update usernameslist.txt --- usernameslist.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/usernameslist.txt b/usernameslist.txt index dd14147..b330850 100644 --- a/usernameslist.txt +++ b/usernameslist.txt @@ -2,4 +2,11 @@ ElonMusk Twitter TwitterCreators TwitterSupport -TwitterAPI \ No newline at end of file +TwitterAPI +TwitterSafety +verified +TwitterBlue +TwitterDesign +TwitterEng +Policy +TwitterDev From f6cb96283b0ff3544d0a1ae4983269c33238d797 Mon Sep 17 00:00:00 2001 From: Penelope Gomez / Pogmommy Date: Tue, 7 Feb 2023 22:23:57 -0700 Subject: [PATCH 2/2] Update multi.js --- multi.js | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/multi.js b/multi.js index ec21bb2..4e5903a 100644 --- a/multi.js +++ b/multi.js @@ -1,15 +1,29 @@ -const args = process.argv; -const defArgs = ["node","path","name","tweetCount","0","write","printHeader"] -for (var i = 0; i < 2; i++) {args.shift();} -const config = require('fs').readFileSync("./usernameslist.txt").toString().split(/[\r\n]+/); -for (let name of config) { - var pArgs = [...args]; - pArgs.splice(0, 0, name); - for (var i = 3; i < 7; i++) { - if (typeof pArgs[i-2] == 'undefined') { - pArgs.push(defArgs[i]); +const childProcess = require('child_process') +const path = require('path'); +async function fork(scriptPath, args = []) { + return new Promise((resolve, reject) => { + let process = childProcess.fork(scriptPath, args, { + cwd: path.dirname(scriptPath) + }); + + process.on('exit', code => resolve(code)); + process.on('error', err => reject(err)); + }); +} +(async function(){ + const args = process.argv; + const defArgs = ["node","path","name","tweetCount","0","write","fromLoop"] + for (var i = 0; i < 2; i++) {args.shift();} + const config = require('fs').readFileSync("./usernameslist.txt").toString().split(/[\r\n]+/); + for (let name of config) { + var pArgs = [...args]; + pArgs.splice(0, 0, name); + for (var i = 3; i < 7; i++) { + if (typeof pArgs[i-2] == 'undefined') { + pArgs.push(defArgs[i]); + } } + console.log("pArgs: " + pArgs); + await fork('./TwitToMast.js', pArgs); } - console.log("pArgs: " + pArgs); - require('child_process').fork('./TwitToMast.js',pArgs); -} \ No newline at end of file +}());