public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Joni Eskelinen <jonieske@gmail.com>
To: cygwin@cygwin.com
Subject: Re: [ANNOUNCEMENT] New: cygextreg-1.2.0-1
Date: Tue, 09 May 2017 09:57:00 -0000	[thread overview]
Message-ID: <c9aa6066-6eb4-4c33-7f65-7dd1c34203e1@gmail.com> (raw)
In-Reply-To: <1351717921.20170505141750@yandex.ru>

On 5.5.2017 14.17, Andrey Repin wrote:
> Greetings, Joni Eskelinen!
> 
>> The following package has been added to the Cygwin distribution:
> 
>> * cygextreg-1.2.0-1
> 
> 
>> Scripts are executed with bash
> 
> This must not be the case, unless explicitly requested. Enough that
> all Windows associations are executed with cmd if you try to
> CreateProcess blindly. Don't copy this mistake.
> 
Bash is used as an intermediary shell that executes the script.
Generally a shebang line denotes the actual interpreter.

Bash was chosen because it's bundled with a default Cygwin installation.

> If you want to make it useful, write a thin wrapper over exec() that
> finds out and runs proper interpreter, and support it with options to
> make interpreters happy. F.e. convert $0 to Cygwin path, if
> interpreter don't understand native paths (i.e. dash cringe over
> non-latin1 native paths and I yet to find out why).
> 
All native paths are converted to Cygwin equivalents before invoking
bash, ie. $0 as in the path of the file that was clicked from Windows,
and consecutive arguments if some files were dragged and dropped to
registered file icon.
That is, the script shall always receive only Posix style paths, by design.

>> in an interactive login shell.
> 
> This should be optional. Login shell may cause $(pwd) to change, not 
> to mention, it alters environment.
> 
>> If the executed script exits with a non-zero code, MinTTY window
> 
> This should be optional.
> 
>> shall be kept open
> 
> This should be optional.
> 
Nice suggestions. I've thought to implement per extension options
especially for keeping the window open after completion.

Script is actually invoked roughly as follows:
/bin/bash -il -c 'cd <directory> && ./<filename>'
with proper escaping applied. So even though user's personal init script
changes the working directory, the script will be invoked in its
containing directory.
I think it's a reasonable default to have bash run this way, since
there's a fair chance that scripts require environmental variables set
in .bashrc or like (eg. $PATH to ruby gems).

- Joni

--
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	other threads:[~2017-05-09  6:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-04  8:27 Joni Eskelinen
2017-05-04 15:48 ` Brian Inglis
     [not found]   ` <555ad225-c208-9f89-3779-e2e0e07d5cfe@gmail.com>
2017-05-09 18:05     ` Brian Inglis
2017-05-05 11:20 ` Andrey Repin
2017-05-09  9:57   ` Joni Eskelinen [this message]
2017-05-09 23:02     ` Andrey Repin
2017-05-10  5:33       ` Joni Eskelinen

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=c9aa6066-6eb4-4c33-7f65-7dd1c34203e1@gmail.com \
    --to=jonieske@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).