delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/03/03/23:43:34

X-Spam-Check-By: sourceware.org
To: cygwin AT cygwin DOT com
From: David Abrahams <dave AT boost-consulting DOT com>
Subject: Re: very odd behavior of Cygwin python from CMD
Date: Sat, 03 Mar 2007 23:42:12 -0500
Lines: 36
Message-ID: <87wt1xhb6j.fsf@valverde.peloton>
References: <87d53qhxk4 DOT fsf AT valverde DOT peloton> <877itxiu6k DOT fsf AT valverde DOT peloton> <45EA3ABD DOT 4E45BDC5 AT dessent DOT net>
Mime-Version: 1.0
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/23.0.0 (gnu/linux)
X-IsSubscribed: yes
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

Brian Dessent <brian AT dessent DOT net> writes:

> David Abrahams wrote:
>
>> Now, I am writing a program that must use CMD to probe for python in
>> the PATH and check its version.  If I do the naive thing and just try
>> to invoke "python," and there's a Cygwin installation, my program will
>> crash or freeze.  So the question is, what do I do instead?
>
> One way to handle this would be to check if the thing found in the path
> looks like a symlink (say, by having a size less than a hundred bytes
> and the 'S' attribute set) 

Ouch.  From the looks of it, even some symlinks to executables
(e.g. python) get an .exe extension, so unless anyone else has bright
ideas, that's what I'll /have/ to do.  What a hack (no offense
intended).

> and if so, launch it as "sh.exe -c python", using sh.exe in the same
> dir as the shortcut.  This will invoke python through the shell,
> which will follow symlinks.

Ja; except that that begs the question -- sh.exe could be a symlink,
as it often is to bash.  In fact it isn't even important for me to
invoke python in that case; I just need to detect it and avoid it.

> Non-cygwin programs will have no idea what a symlink is.

Right.

Thanks,

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019