delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/03/23/04:29:09

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Mon, 23 Mar 2009 10:28:45 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: 1.7.0: Getting a Windows app to run synchronously to a script from which it is invoked
Message-ID: <20090323092845.GJ9322@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <49C6D72D DOT 4090804 AT veritech DOT com>
MIME-Version: 1.0
In-Reply-To: <49C6D72D.4090804@veritech.com>
User-Agent: Mutt/1.5.19 (2009-02-20)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mar 22 20:26, Lee D.Rothstein wrote:
> This is in all probability, not a bug. I suspect it falls into CGF's
> category of "works but isn't (wasn't) guaranteed."
>
> All of my scripts (developed under Cygwin 1.5 or earlier) that involve
> a Windows native app use:
>
>  winapp "$(cygpath -w $something)"
>
> have stopped working "properly" since I installed Cygwin 1.7.
>
> Here's the script I use, FOR EXAMPLE, for invoking Windows Explorer to the
> current directory or a specified Cygwin directory path, AND that stops
> further use of the invoked from "terminal" window, until this Explorer
> window terminates:
>
>  #!/usr/bin/bash
>
>  if [[ -n "$1" ]] ; then cd "$1" ; fi
>  explorer "$(cygpath -w .)"

I'm somewhat puzzled.

First of all, the explorer command does not stop input from the
terminal.  When I invoke the above script, I get an explorer window
*and* I can type into the calling shell again because explorer is
running detached.  Experiments with notepad show that notepad is running
synchronously, so in that case the shell is waiting for notepad to exit.
I get this behaviour consistently on 1.5 and 1.7.

Second, in my case the explorer window is opened in the correct
directory.  Again, this works fine in 1.5 and 1.7.

Is it possible that this is OS dependent?  I've tested on XP SP3.

> Is there no straight-forward way to invoke a windows app from a script
> synchronously with Cygwin 1.7?

I don't think so, at least not really and I'm not sure that's
Cygwin's fault or something.  Sometimes when you think you start
a Windows application you actually just call a wrapper which then
starts another application using COM or other methods.  In case
of explorer, there's no guarantee that you really start the process
which then opens the window.  For instance, there's a folder option
in Explorer called "Launch folder windows in a separate process".
So, given that one instance of explorer is running the GUI anyway,
which process will run the newly opened window?


Corinna


P.S.: If that would be my script, I'd use cygpath -wa, to get always
an absolute Windows path, btw.  This removes the trailing backslash
you always get when calling `cygpath -w .'.


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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/

- Raw text -


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