This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: 1.7.0: Getting a Windows app to run synchronously to a script from which it is invoked

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?


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:
Problem reports:

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]