text: console.log('Starting...')
  let cluster = require('cluster')
  let path = require('path')
  let fs = require('fs')
  let package = require('./package.json')
  const cfonts = require('cfonts')
  const Readline = require('readline')
  const yargs = require('yargs/yargs')
  const rl = Readline.createInterface(process.stdin, process.stdout)
  
  cfonts.say('Akaishi\nMulti-device', {
    font: 'chrome',
    align: 'center',
    gradient: ['red', 'magenta']
  })
  cfonts.say(`'${package.name}' By @${package.author.name || package.author}`, {
    font: 'console',
    align: 'center',
    gradient: ['red', 'magenta']
  })
  
  var isRunning = false
  /**
   * Start a js file
   * @param {String} file `path/to/file`
   */
  function start(file) {
    if (isRunning) return
    isRunning = true
    let args = [path.join(__dirname, file), ...process.argv.slice(2)]
    cfonts.say([process.argv[0], ...args].join(' '), {
      font: 'console',
      align: 'center',
      gradient: ['red', 'magenta']
    })
    cluster.setupMaster({
      exec: path.join(__dirname, file),
      args: args.slice(1),
    })
    let p = cluster.fork()
    p.on('message', data => {
      console.log('[RECEIVED]', data)
      switch (data) {
        case 'reset':
          p.kill()
          isRunning = false
          start.apply(this, arguments)
          break
        case 'uptime':
          p.send(process.uptime())
          break
      }
    })
    p.on('exit', code => {
      isRunning = false
      console.error('Exited with code:', code)
      if (code === 0) return
      fs.watchFile(args[0], () => {
        fs.unwatchFile(args[0])
        start(file)
      })
    })
    let opts = new Object(yargs(process.argv.slice(2)).exitProcess(false).parse())
    if (!opts['test'])
      if (!rl.listenerCount()) rl.on('line', line => {
        p.emit('message', line.trim())
      })
    // console.log(p)
  }
  
  start('main.js')
  