Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Subject: RE: Run program in background. Date: Tue, 5 Oct 2004 09:44:11 -0400 Message-ID: <64AE3D5B518E3648ACC823FBCB0B737502A6B3FB@sr002-2kexc.ateb.com> X-MS-Has-Attach: X-MS-TNEF-Correlator: From: "Reid Thompson" To: X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i95DiRaD023204 Brian Dessent wrote: > > If you just want your program to simply run in the > background, launch it with a "&" at the end of the command > from the shell. However, if it expects to use stdout, stdin, > or stderr, it will stop -- so these must all be redirected to files > or pipes. not exactly correct the program does not stop, stdin is not accessible via the shell, but stdout and stderr are by default, still routed to it. $ cat back.c #include int main (void) { int ctr = 0; printf("From stdout\n"); fprintf(stderr, "From stderr\n"); for (ctr = 0; ctr < 5; ++ctr) { printf("%d\n", ctr); sleep(2); } return(0); } WS-XP-4960:/home/rthompso> $ ./a & [2] 5076 WS-XP-4960:/home/rthompso> $ From stdout From stderr 0 1 2 3 4 [2]+ Done ./a -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/