delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/03/03/22:19:43

X-Spam-Check-By: sourceware.org
Message-ID: <45EA3ABD.4E45BDC5@dessent.net>
Date: Sat, 03 Mar 2007 19:19:25 -0800
From: Brian Dessent <brian AT dessent DOT net>
X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: very odd behavior of Cygwin python from CMD
References: <87d53qhxk4 DOT fsf AT valverde DOT peloton> <877itxiu6k DOT fsf AT valverde DOT peloton>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
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

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) 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.  Non-cygwin programs will
have no idea what a symlink is.

Brian

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