How to run ionic in the background

吃可爱长大的小学妹 提交于 2019-12-31 01:33:28

问题


I am trying to run ionic serve in the background so I can test it via my rails app on circle ci. I thought I could do it with:

nohup bash -c "ionic serve --nolivereload --nobrowser &"

But unfortunately it doesn't work. Does anyone know how to run it in the background?


回答1:


You could use screen:

screen -d -m -L ionic serve --nolivereload --nobrowser



回答2:


Why do you want it to run in background on CI ?

It should be ok to run the command directly before your test:

ionic serve --nolivereload --nobrowser &

Your CI should kill all the triggered process once its done...

Update:

If your CI does not kill the triggered process, you could do something like this:

ionic serve --nolivereload --nobrowser &
ionicpid=$!
your_test_command_here
kill -15 $ionicpid

It should work on CI if all of these commands are in the same job.




回答3:


On CircleCI I have found this setup to work well

machine:
  node:
    version: v7.4.0

test:
  pre:
    - npm run webdriver-update
    - ionic serve --nolivereload --nobrowser --port 8101:
        background: true
    - sleep 15

  override:
    - npm run e2e



回答4:


Here's a method that actually works (sorry so late)

sleep 999999999 | ionic serve -b &

I think there's an easy way in ionic v3, but this works for v1



来源:https://stackoverflow.com/questions/31189300/how-to-run-ionic-in-the-background

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!