delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/01/25/15:05:14

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <388E03A8.4B6EBCF5@veritas.com>
Date: Tue, 25 Jan 2000 12:12:24 -0800
From: Bob McGowan <Robert DOT McGowan AT veritas DOT com>
Organization: VERITAS Software
X-Mailer: Mozilla 4.7 [en] (WinNT; U)
X-Accept-Language: en
MIME-Version: 1.0
To: Joe Burpee <jeb AT burkby DOT com>
CC: Cygwin <cygwin AT sourceware DOT cygnus DOT com>
Subject: Re: Start background process under bash
References: <38876DC8 DOT 1340D6B5 AT burkby DOT com> <38877D2A DOT 832984B7 AT veritas DOT com> <388DF333 DOT 17F993A3 AT burkby DOT com>

Joe,

First, I'm adding the cygwin list back in the CC field.  This is
"normal" for discussion, so others can add or modify (and correct ;-)
suggestions, etc.

You mention using the DOS box "start /b" to get a process running in the
bash background.  Since the start command is part of the CMD.EXE and not
of bash, I'm not sure I understand what you are doing.  For a background
process in bash, you would run:

	bash-02$ command args... &
	bash-02$

which has always worked for me.  The ampersand tells bash to start the
command but not wait for it to exit.

Using start in a cmd prompt sort of emulates UNIX background processes,
but I believe the process structure of windows results in a brand new,
unrelated to the original, set.  (I am not an expert on this, though. 
Perhaps others could provide a more precise explanation.)  Suffice it to
say, I can do the following:

	bash-02$ cmd /c "start bash"

and get a brand new window with a bash command prompt, where the new
bash process (in cygwin/unix terms) is its own parent.  Normally, a
background process will have a parent PID equal to the process that
started it.  If I add the /b option to the start command in the above
example,  I get 2 bash shells competing for the single input focus.  A
ps -f in a separate shell still shows that the bash running via the
start command is its own parent (so not a "true" background process) and
is not manageable using the bash 'jobs' command or the '%#' background
jobs referencing features.

I hope this helps point you in a useful direction.

Bob

Joe Burpee wrote:
> 
> Bob McGowan wrote:
> > You didn't mention whether you are using the beta or CD version.
> 
> I'm using B20.1 (beta); sounds like I should get the CD.
> 
> > I am using the Cygwin CD 1.0, no updates, on both NT4 and NT2K and can
> > run processes in the background inside a scripts using the & without any
> > error popups (in fact, I am running a script now - actually puts a
> > function in the background, which is done by running multiple copies of
> > bash).  You may want to try "standard" method again (in case you haven't
> > yet).
> 
> I think my client's NT4 setup must be snafu.  Using the DOS box command
> "start /b" I can get one process running in the bash background, but
> only one.  And other processes, like readline, seem to be dead while the
> background job is running.  I guess there's a process priority problem
> somewhere.
> 
> Thanks for the info.  Some reason for optimism.
> 
> Joe

-- 
Bob McGowan
Staff Software Quality Engineer
VERITAS Software
rmcgowan AT veritas DOT com

--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019