This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: very odd behavior of Cygwin python from CMD


Brian Dessent <brian@dessent.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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]