| delorie.com/archives/browse.cgi | search |
| 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:date:from:reply-to:message-id:to:subject | |
| :in-reply-to:references:mime-version:content-type | |
| :content-transfer-encoding; q=dns; s=default; b=Nc+2rNN3IRfN1XHR | |
| XJ1H96JHkqBtNeZaxcgeHN9FYIpA4Raws4h0uX1fCO3PP/AyVz+C222H7MNzp0EK | |
| BKCKcr+/GFdhLQmAU1+fXOcLMrbg/omxQ654IZH29+TnlabrO2fCP5uwtvxqYCWi | |
| 9tjnqiomesj+KbCalFqwMGMM8+M= | |
| 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:date:from:reply-to:message-id:to:subject | |
| :in-reply-to:references:mime-version:content-type | |
| :content-transfer-encoding; s=default; bh=0o5KomZRynd5z47DdvxHcv | |
| Tvt9Y=; b=UVFIJ3mweaoKsDLI2Wq1kgBHz4ZQtw1n9PN007bLfu6gv0Pe2v1byP | |
| BaJqhgG7ZzSDntckb0ktYrUDKjARgHM5WxSZ1+K8Nx5wifHpZnngnACoy2/v731O | |
| hpraDUSuIDZViD9w/wBcn/Q8D2ojMFXHHQSWl9LJU3OChbjX2/R6U= | |
| 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-Virus-Found: | No |
| X-Spam-SWARE-Status: | No, score=-3.3 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,KAM_THEBAT,SPF_SOFTFAIL autolearn=no version=3.3.2 |
| X-HELO: | smtp.ht-systems.ru |
| Date: | Wed, 5 Nov 2014 22:11:33 +0300 |
| From: | Andrey Repin <anrdaemon AT yandex DOT ru> |
| Reply-To: | cygwin AT cygwin DOT com |
| Message-ID: | <1095569719.20141105221133@yandex.ru> |
| To: | Kal Sze <swordangel AT gmail DOT com>, cygwin AT cygwin DOT com |
| Subject: | Re: Running non-cygwin executables in cygwin bash terminal or script |
| In-Reply-To: | <CAGZiy731mOGON-Bhd9XYZo-8jQ0WrLKOioxKBGnJrZbDprGvPg@mail.gmail.com> |
| References: | <CAGZiy731mOGON-Bhd9XYZo-8jQ0WrLKOioxKBGnJrZbDprGvPg AT mail DOT gmail DOT com> |
| MIME-Version: | 1.0 |
| X-IsSubscribed: | yes |
Greetings, Kal Sze!
> In general, is there anything that can go wrong or not work if I
> invoke regular Windows/.NET executables (not compiled with any cygwin
> header or linked with any cygwin dll) from a cygwin bash terminal or
> script?
Speaking veeery-veeery generally, no. A program is a program. If it can be
run, it'll run. (I.e., I'm starting WoW client from shell script.)
However, there's a number of things you should be aware of.
> I am planning to write a bash script to call rsync and then a command
> line program written in C# (.NET framework 4.5 in Visual Studio 2013).
> I'm not a huge cygwin/posix/unix hacker, so there are a few things
> that seem murky. I suppose that are other people in similar
> situations.
> I can think of a few things that don't seem entirely clear in the
> documentation and FAQ.
> I'm guessing that invoking regular Windows/.NET executables would
> mostly just work, with the following caveat:
> - stdin/stdout/stderr redirection and piping would still work, even
> when piping with cygwin-linked programs (care with charset and
> end-of-line conventions needs to be taken, however);
Right.
> - UNIX-style sockets are out of the question;
If you want your non-cygwin program communicate through Cygwin sockets, you
are in for a lot of trouble. Not strictly "out of question", but "largely not
worth the time spent".
> - the usual Window permission model would still be used;
More or less. There's caveats imposed by POSIX approximation of Windows ACLs.
> - if the regular Windows/.NET executable accepts a file or directory
> path as argument, it still needs to be written in the Windows style
> (i.e. "C:\\foobar\\" instead of "/cygdrive/c/foobar");
"C:/foobar" would work in most cases, so do "/foobar", assuming you know what
you are doing.
> - the locale of the cygwin bash process may cause problems when
> passing arguments to the regular Windows program.
If it's usual LANG=whatever.UTF-8, yes.
If it's more friendly single-byte encoding, should not be a problem.
> Am I mostly correct? So far it seems to work. Am I missing other caveat?
> Would it make sense to have all this summarized in the FAQ?
You forgot another important moment. Since non-cygwin applications have no
conception of pty's, running them in default Cygwin terminal (mintty) and read
their output may prove to be a challenge.
You could, however, use native console instead (i.e. running bash directly,
instead of letting mintty do it). Combined with appropriate LANG= settings,
that could be the way to go.
P.S.
----------8<----------8<----------8<----------
case "$TERM" in
xterm*)
LANG=ru_RU.UTF-8
;;
*)
LANG=ru_RU.CP866
;;
esac
export LANG
---------->8---------->8---------->8----------
--
WBR,
Andrey Repin (anrdaemon AT yandex DOT ru) 05.11.2014, <21:57>
Sorry for my terrible english...
--
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
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |