parent
15b51bb3eb
commit
7b92f894a4
|
@ -21,8 +21,7 @@ OTP_SECRET=foobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoobarfoo
|
|||
|
||||
const mastodonDir = path.join(dir, '../mastodon')
|
||||
|
||||
let railsChildProc
|
||||
let webpackChildProc
|
||||
let childProc
|
||||
|
||||
async function cloneMastodon () {
|
||||
try {
|
||||
|
@ -55,6 +54,7 @@ async function runMastodon () {
|
|||
console.log('Running mastodon...')
|
||||
let cmds = [
|
||||
'gem install bundler',
|
||||
'gem install foreman',
|
||||
'bundle install',
|
||||
'yarn --pure-lockfile'
|
||||
]
|
||||
|
@ -63,19 +63,11 @@ async function runMastodon () {
|
|||
console.log(cmd)
|
||||
await exec(cmd, {cwd: mastodonDir})
|
||||
}
|
||||
const promise = spawn('foreman', ['start'], {cwd: mastodonDir})
|
||||
const log = fs.createWriteStream('mastodon.log', {flags: 'a'})
|
||||
|
||||
railsChildProc = spawn(
|
||||
'bundle', ['exec', 'rails', 'server'], {cwd: mastodonDir}
|
||||
).childProcess
|
||||
railsChildProc.stdout.pipe(log)
|
||||
railsChildProc.stderr.pipe(log)
|
||||
|
||||
webpackChildProc = spawn(
|
||||
'./bin/webpack-dev-server', [], {cwd: mastodonDir}
|
||||
).childProcess
|
||||
webpackChildProc.stdout.pipe(log)
|
||||
webpackChildProc.stderr.pipe(log)
|
||||
childProc = promise.childProcess
|
||||
childProc.stdout.pipe(log)
|
||||
childProc.stderr.pipe(log)
|
||||
}
|
||||
|
||||
async function main () {
|
||||
|
@ -88,13 +80,9 @@ async function main () {
|
|||
}
|
||||
|
||||
function shutdownMastodon() {
|
||||
if (railsChildProc) {
|
||||
console.log('killing rails child process')
|
||||
railsChildProc.kill()
|
||||
}
|
||||
if (webpackChildProc) {
|
||||
console.log('killing webpack child process')
|
||||
webpackChildProc.kill()
|
||||
if (childProc) {
|
||||
console.log('killing child process')
|
||||
childProc.kill()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue