Update multi.js
This commit is contained in:
parent
68fc212d4b
commit
f6cb96283b
1 changed files with 27 additions and 13 deletions
18
multi.js
18
multi.js
|
@ -1,5 +1,18 @@
|
|||
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","printHeader"]
|
||||
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) {
|
||||
|
@ -11,5 +24,6 @@ for (let name of config) {
|
|||
}
|
||||
}
|
||||
console.log("pArgs: " + pArgs);
|
||||
require('child_process').fork('./TwitToMast.js',pArgs);
|
||||
await fork('./TwitToMast.js', pArgs);
|
||||
}
|
||||
}());
|
||||
|
|
Reference in a new issue