X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_23,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Message-ID: <49C72466.6080307@veritech.com> Date: Mon, 23 Mar 2009 01:55:50 -0400 From: "Lee D.Rothstein" Reply-To: Cygwin Tech List User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Cygwin Tech List Subject: 'cygstart' option? was Re: 1.7.0: Getting a Windows app to run synchronously to a script from which it is invoked References: <49C6D72D DOT 4090804 AT veritech DOT com> In-Reply-To: <49C6D72D.4090804@veritech.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.0.1 X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 I figured out a solution, but it still has limitations. The solution: It just requires doing a cd into the path (complete directory path) of the argument, and cd'ing into that path. If the command operates on a directory as Explorer does, then you submit '.' as the argument. If the command requires a file name, you just submit the 'basename' as the argument. I used to do this years ago (starting with the MKS toolkit, and then the Thompson toolkit), but stopped once I became conversant with 'cygpath'. Brain damage is my excuse for forgetting. However, this will only work with Windows programs that themselves are synchronous, OTB (out of the box). This won't work, for example, with OpenOffice (OO) after about version 1.5, or WinWord after version 10, or thereabouts. OO really bummed me out, when they made the change, invalidating all my blogging scripts. That's when I started using the 'read' nonsense. Actually, more recently, they both require 'cygstart' or they flat out blow up. However, you don't have to specifiy the command name at all, just the file name argument. But you still end up with the asynch start. In brief, it would be very nice if there was a cygstart option that did not exit until the command which it starts exits. Is this possible? Lee 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 .)" > > Explorer opens okay, but always to the "Computer" folder, rather than the > current working or specified directory. (Yes, I know that there is a > special option for Explorer in 'cygstart'. Please read on.) > > I found that I can make the above work by replacing the invocation using > 'cygpath' with a 'cygstart' initiated invocation without 'cygpath', at > all. The problem with this latter fix, however, is that 'cygstart' > invokes > the Windows app asynchronously to the script in which it is contained. > Sometimes I want the script continuance to be "tethered" to the Windows > app, and the only way to do this (that I can see), is to put an otherwise > superfluous 'read' statement right after the Windows app invocation. > Ugly, > and not as obvious, to the user, as the old method. > > Is there no straight-forward way to invoke a windows app from a script > synchronously with Cygwin 1.7? > > > -- > 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/ > > -- 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/