1
0
Fork 0

should be spawn instead of execFile

refactor/models
Matthew 2019-12-20 12:18:19 -05:00
parent de6ed2d37f
commit ace7594c12
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
1 changed files with 8 additions and 1 deletions

View File

@ -1,5 +1,6 @@
/* eslint-disable no-await-in-loop */ /* eslint-disable no-await-in-loop */
// import fs from 'fs-extra'; // import fs from 'fs-extra';
import { spawn } from 'child_process';
import { Client } from '..'; import { Client } from '..';
export default async function storage(client: Client) { export default async function storage(client: Client) {
@ -24,5 +25,11 @@ export default async function storage(client: Client) {
setInterval(async () => { setInterval(async () => {
await main(); await main();
}, 900000); */ }, 900000); */
(await import('child_process')).execFile('./storage'); let storageGo = spawn('./storage', []);
storageGo.stdout.on('data', (data) => client.signale.log(data));
storageGo.stderr.on('data', (data) => client.signale.log(data));
storageGo.on('exit', (code) => {
client.signale.log(`Go storage func exited with code ${code}, restarting`);
storageGo = spawn('./storage', []);
});
} }