X-Recipient: archive-cygwin@delorie.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=exMxkIzFoP5qQ1MS
	OV7CezzhzF6q/6syKRNJV9OYvvj+m/+1SDBiMQhNrMYFfxKnDCBNPFP6hKvvcsK1
	BsSnMvW/dPIMT7tohvtHVkOkMmSCcuFzCBOBZzyzXOfGOsJdnozOSlPGW32AimQ3
	U411ib7vseCg/FR01gR9WJNdeME=
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=a8Oe40UJcmCoIrgZKruHMb
	Z30ds=; b=lIU9M5u0KAnsEyc7s/4f7d7tJz0A5xXiIvW5D6RAvI+bqAdgfTeiCp
	3SvP86H/0L8BLuOa53/0fD5ltBlbH1264GAbHouixK7fn7J4IjStcCbmKeQydHHd
	vRoLDD5aOPWtxYcp2RR7BqxAtSWif2gmDXW2daZAsYa3CyjchfQmY=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=completion, environmental, ruby, fe
X-HELO: mail-wr0-f172.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20161025;        h=x-gm-message-state:subject:to:references:from:message-id:date         :user-agent:mime-version:in-reply-to:content-transfer-encoding;        bh=F79Ba95CDcu9Sim8uBfOUTgR8vsnsQ3wtrz1dUlzC6s=;        b=RQY7GmT2uew1jnq/k22v+51oARoQOkD6qpL54KNys0kmtKj1SAQSmC2pNziiLbaNjH         gf70Fm0YStYYYk7FSkp4p+ga4uiqYpKP+RjNx9GmerA7F1fgXt3OemR8xCszzyeFL8M7         y6E6xwNLY5K+pF5NMzaLgMag+slV1ineB8Egqto/oaQF3zCymny32EBzxCZwrpHb3xJ0         0bkWuG05PB0kWdOH4o3OX/cX30zsJneljORkRRgkLqZy2mYSOetPJ2m1xNu+NVOEUeBG         b95+SQ5WbdWrOhRgEoh9BjHHBxW5Gsm1Imw5i5bN5wYb2SEwbu+UVf6VtsQ9CyEQIZOB         g22Q==
X-Gm-Message-State: AODbwcCMrTlqtH9sw6/7y7VfmCa6UH1qSUcRwrY0CTL2N7mtKzbGbbCP	5jEiW831/tT4So+wm8A=
X-Received: by 10.46.22.18 with SMTP id w18mr7017641ljd.85.1494310649442;        Mon, 08 May 2017 23:17:29 -0700 (PDT)
Subject: Re: [ANNOUNCEMENT] New: cygextreg-1.2.0-1
To: cygwin@cygwin.com
References: <announce.131486df-0b2e-a6d7-9840-21ecd08755a9@gmail.com> <1351717921.20170505141750@yandex.ru>
From: Joni Eskelinen <jonieske@gmail.com>
Message-ID: <c9aa6066-6eb4-4c33-7f65-7dd1c34203e1@gmail.com>
Date: Tue, 9 May 2017 09:17:29 +0300
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version: 1.0
In-Reply-To: <1351717921.20170505141750@yandex.ru>
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

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

