1
0
Fork 0
cloudservices/src/intervals/storage.ts

15 lines
630 B
TypeScript
Raw Normal View History

2019-11-09 23:05:34 -05:00
/* eslint-disable no-await-in-loop */
2019-12-18 23:47:08 -05:00
// import fs from 'fs-extra';
2019-12-20 12:18:19 -05:00
import { spawn } from 'child_process';
2019-11-09 23:05:34 -05:00
import { Client } from '..';
2019-11-09 23:46:21 -05:00
export default async function storage(client: Client) {
2019-12-20 12:54:35 -05:00
let storageGo = spawn(`${__dirname}/../bin/storage`, [], { cwd: __dirname });
2019-12-20 12:50:19 -05:00
storageGo.stdout.on('data', (data) => client.signale.log(data.toString()));
storageGo.stderr.on('data', (data) => client.signale.log(data.toString()));
2019-12-20 12:18:19 -05:00
storageGo.on('exit', (code) => {
client.signale.log(`Go storage func exited with code ${code}, restarting`);
2019-12-20 12:54:35 -05:00
storageGo = spawn(`${__dirname}/../bin/storage`, [], { cwd: __dirname });
2019-12-20 12:18:19 -05:00
});
2019-11-09 23:05:34 -05:00
}