/* eslint-disable no-await-in-loop */ // import fs from 'fs-extra'; import { spawn } from 'child_process'; import { Client } from '..'; export default async function storage(client: Client) { let storageGo = spawn(`${__dirname}/../bin/storage`, [], { cwd: __dirname }); storageGo.stdout.on('data', (data) => client.signale.log(data.toString())); storageGo.stderr.on('data', (data) => client.signale.log(data.toString())); storageGo.on('exit', (code) => { client.signale.log(`Go storage func exited with code ${code}, restarting`); storageGo = spawn(`${__dirname}/../bin/storage`, [], { cwd: __dirname }); }); }