public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: cyg Simple <cygsimple@gmail.com>
To: cygwin@cygwin.com
Subject: Re: how is cygstart different from cmd /c or how to have cygstart start 'inline'?
Date: Sat, 22 Dec 2018 10:26:00 -0000	[thread overview]
Message-ID: <8df0941a-7c83-8360-e8c1-978c7e683af5@gmail.com> (raw)
In-Reply-To: <5C1C973B.7050509@tlinx.org>

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@users.sourceforge.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@users.sourceforge.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@users.sourceforge.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

      parent reply	other threads:[~2018-12-21 15:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-21 13:15 L A Walsh
2018-12-21 15:12 ` Brian Inglis
2018-12-24 15:31   ` L A Walsh
2018-12-22 10:26 ` cyg Simple [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8df0941a-7c83-8360-e8c1-978c7e683af5@gmail.com \
    --to=cygsimple@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).