Running command in background using cygwin from Windows cmd

為{幸葍}努か 提交于 2019-12-21 17:57:09

问题


I use cygwin from my Windows command line, I've always done everything quite happily except being able to run something in the background (i.e. putting & at the end of a command).

Just to give you more context, I want to be able to start a Mercurial web server and still be able to keep using the command line window and even closing it without killing the server. For example:

>hg serve &
listening at http://localhost:8000/ (bound to *:8000)
>echo "Still able to do this"

Any workarounds to this?


回答1:


I had a similar problem running Apache, finally I used cygstart, it's like CMD start:

cygstart --hide /c/apache/bin/httpd.exe

In this case, it will run Apache as an background proccess thanks to the --hide option




回答2:


Found the solution:

start <command> /B

start is a windows command, do a help start for more info

Alternatively and for my case

hg serve --daemon

or

hg serve -d

will do the trick



来源:https://stackoverflow.com/questions/10158158/running-command-in-background-using-cygwin-from-windows-cmd

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