how is cygstart different from cmd /c or how to have cygstart start 'inline'?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

how is cygstart different from cmd /c or how to have cygstart start 'inline'?

L A Walsh
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
}


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

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

Thanks!
Linda


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

Reply | Threaded
Open this post in threaded view
|

Re: how is cygstart different from cmd /c or how to have cygstart start 'inline'?

Brian Inglis
On 2018-12-21 00:33, 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.

See:
https://github.com/mintty/mintty/wiki/Tips#inputoutput-interaction-with-alien-programs

> I compared env's and noted both PATH and TMP had been converted back to the
> backslash using case, so I did that manually:
> 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
> }
> So what else does cygstart do that I might setup before a "cmd /c" to get the
> target to run?

START - Starts a separate window to run a specified program or command

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

If it's a console cmd it should run under a term without any problems:

$ cmd /c ver

Microsoft Windows [Version 10.0.17134.471]

or you may need to use https://github.com/rprichard/winpty - allows running
Windows console programs under mintty or Cygwin's sshd with properly-functioning
input and output by starting winpty-agent with a hidden console window, which
bridges between the console API and terminal input/output escape codes, polls
the hidden console's screen buffer for changes and generates a corresponding
stream of output.

--
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

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

Reply | Threaded
Open this post in threaded view
|

Re: how is cygstart different from cmd /c or how to have cygstart start 'inline'?

cyg Simple
In reply to this post by L A Walsh
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:[hidden email]
#   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:[hidden email]
#   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:[hidden email]
#   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

Reply | Threaded
Open this post in threaded view
|

Re: how is cygstart different from cmd /c or how to have cygstart start 'inline'?

L A Walsh
In reply to this post by Brian Inglis


On 12/21/2018 5:15 AM, Brian Inglis wrote:

> See:
> https://github.com/mintty/mintty/wiki/Tips#inputoutput-interaction-with-alien-programs
---
Will have to read it in more detail...look like alot of neat things
to try out (not sure how useful relating to my question, but
maybe...so much there).


> If it's a console cmd it should run under a term without any problems:
> $ cmd /c ver
---
        Well, that's the rub -- if it started so easily,
I wouldn't be asking :-). **


>
> Microsoft Windows [Version 10.0.17134.471]
>
> or you may need to use https://github.com/rprichard/winpty 
---
that looked cool until I got a bit farther...

> - allows
> running Windows console programs under mintty or Cygwin's sshd with
> properly-functioning input and output by starting winpty-agent with
> a hidden console window,
---
        Iiieeee!.  Like the Console2 program... stretches
compatibility to the limit.

> which bridges between the console API and
> terminal input/output escape codes, polls the hidden console's
> screen buffer for changes and generates a corresponding stream of
> output.
---
        Yeah, it was that polling thing that was a prob --
fast enough poll to provide real-time I/O = fast enough to be a
noticeable drain on the cpu.  Polling=bad.  Surprised no one has
come out with an interrupt driven version -- so easy on Linux, but
on windows...like extracting teeth it seems.


** -- its a finicky GUI login for a game (BladeandSoul) that has
a evil, malware-like anti-cheat engine that is currently
crashing on my machine.  It does it's best to keep
you from debugging it.  Just trying to start it without using
its desktop-provided link is a first level of pickiness).
 
Best I've gotten so far is using cygstart.
(Feel free to try it out if you want -- free download as well
from www.bladeandsoul.com; the installer will install the launcher
which is small.  My first step is trying to start the launcher
"inline" (not in a separate window).  Beyond the launcher, it will
invite you to create a free login, and then it goes on to
start downloading game (about 10G to start, 30G beyond that),
but quit at that point if you just wanna run instaler.

Trying to start it with cmd /c, results in some fatal error but
cygstart works -- "magic".  :-)

Thanks for the ideas/comments.

-linda



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