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?
If you know you want to run a command in the background, type an ampersand (&) after the command as shown in the following example. The number that follows is the process id. The command bigjob will now run in the background, and you can continue to type other commands.
Go to http://cygwin.com and click on "Install Cygwin" in the left column. This will allow you to download a setup.exe file and choose "Install from Internet." Click "Next." Choose your settings. For most users, it is fine to leave the default installation directory, which is "c:\cygwin\ and the other default settings.
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
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With