delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2018/12/21/10:41:46

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=IbWAOypA8O6UvDW1
h44NLLZczr9lHtgHW4izyxZ9m+2jZHHD9WTovgivIpUZkaj7bnrpOKIPKk+1BNe+
bP8r9QlHL72yR/+Ui14yE+YnJ1jTKYzDID3pU2PDv4I6/WKLxBNlZU4AYX/VXQeA
Yo4YCSc01OnlGnuQFa/dyJMQzZc=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:subject:to:references:from:message-id:date
:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=SNIEJXW9j+iX+mlov1nTjs
NZMFQ=; b=ITKHuqNGrmNh7hKp8YTznAJTiiggcJthRiJpvGEt4LPHh/4bJvP5pI
kzC9Q0Hmp7MTFWgizbSB3kpqMtLb6dAHi6xIZv3yvkfu74IrSgubVqGHhIIQglGS
3gcYtGYgtVzykuaECQ26CNcH3iYNBLdc+bQ9Awxq4d9a/LNmhRoDw=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=communicate, walsh, Walsh, Got
X-HELO: mail-qt1-f179.google.com
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=M/Ghg9eSOVN6pcyxHhH4dqCVHnrJYcJPAOujyS2efSU=; b=PFGtRlOwz1NbBGwR9/g9sLE7kFr1k8mco34M3nrpMRLRkqQSUY3K7wLOW4B89oMNKc Nl66fQWUxCEEVJp7qX9yVmt22wqBKSyrO9Uj4aScPkNgUTUetG6tYbwoo74aN9crIIzJ nGsVBPGDmGq1a6vcdpV/42t9O8sI+RBUqgyk+TcRy7fc8u3gdbcbx49FR6loj+5hrrV3 jQz8XD79teIfHb1khiMWzp5tcnMo87SKHFG5VtsKamos3teBgQCupsrIbvvBo9mMPvF4 TRTWU/e4RAFPKw9Y22K+iYFheParnVOelNSNGeEIuPAuoL8qSIWJx5RWHb0Qb2IdlZVH 3Y8A==
Subject: Re: how is cygstart different from cmd /c or how to have cygstart start 'inline'?
To: cygwin AT cygwin DOT com
References: <5C1C973B DOT 7050509 AT tlinx DOT org>
From: cyg Simple <cygsimple AT gmail DOT com>
Message-ID: <8df0941a-7c83-8360-e8c1-978c7e683af5@gmail.com>
Date: Fri, 21 Dec 2018 10:41:27 -0500
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.3.3
MIME-Version: 1.0
In-Reply-To: <5C1C973B.7050509@tlinx.org>
X-IsSubscribed: yes
Note-from-DJ: This may be spam

On 12/21/2018 2:33 AM, L A Walsh wrote:
> Got a program that starts under cygstart, but I'd
> like to be able to start it without starting up the program
> in a new window..so was trying cmd /c.
> 
> I compared env's and noted both PATH and TMP had been
> converted back to the backslash using case, so I
> did that manually:
> 
> if ((usecmd)); then
>     export TMP=$(cygpath -w $TMP)
>     my newpath=""
>     my sep=""
>     readarray -t pathar < <(echo -E "$PATH"|tr ":" "\n")
>     for p in "${pathar[@]}"; do
>         n=$(cygpath -w "$p")
>         newpath="$newpath$sep$n"
>         #echo -E "newpath=$newpath"
>         sep=";"
>     done
>     export Path=$newpath
> fi
> 
> But no luck in launching (cygstart case works):
> 
> cd "$ldir" && {
>     if ((usecmd)); then
>         'c:/windows/system32/cmd.exe' /c "$lpath" "${args[@]}"
>     else
>         cygstart "$lpath" "${args[@]}"
>     fi
> }
> 

I use:
<file name="/usr/local/bin/cmd'>
#!/usr/bin/env bash
# Copyright (C) 2018, cygSimple
#   mailto:cygSimple AT users DOT sourceforge DOT net
#   https://sourceforge.net/p/cygsimple
# File: cmd

`cygpath "$COMSPEC"` "$@"
</file>

and

<file name="/usr/local/bin/start">
#!/usr/bin/env bash
# Copyright (C) 2018, cygSimple
#   mailto:cygSimple AT users DOT sourceforge DOT net
#   https://sourceforge.net/p/cygsimple
# File: start

cmd /c start `cygpath -w -- "${@//&/^&}"`
</file>

The file /usr/local/bin/start uses the file /usr/local/bin/cmd because 
of PATH.

I use another such file to start the Windows version of gvim.

<file name="/usr/local/bin/gvim">
#!/usr/bin/env bash
# Copyright (C) 2018, cygSimple
#   mailto:cygSimple AT users DOT sourceforge DOT net
#   https://sourceforge.net/p/cygsimple
export PATH=/c/opt/vim/vim74:"$PATH"
start /c/opt/vim/vim74/gvim `cygpath -w -- "$@"` &
</file>

> 
> So what else does cygstart do that I might setup
> before a "cmd /c"
> to get the target to run?
> 

Don't know.

> Or anyway to have cygstart run the command with its output in the
> current window?
> 

A windows program will have a different console by default.  A console 
program could can communicate to the same console as it is started in 
unless it uses pty (e.g. /c/windows/system32/ftp).

-- 
cyg Simple

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


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