This is the mail archive of the
mailing list for the Cygwin project.
Running native exe from Cygwin in random instances reports incorrect error code 127
- From: David Sicilia <dpsicilia at gmail dot com>
- To: cygwin at cygwin dot com
- Date: Mon, 18 Jan 2016 10:27:39 -0500
- Subject: Running native exe from Cygwin in random instances reports incorrect error code 127
- Authentication-results: sourceware.org; auth=none
I have a strange problem for which I could not find any help online or
in the Cygwin FAQs (have been searching for about a month now). I
have Cygwin64 on Windows 7 (downloaded maybe about 8 months ago).
I have a bash script that, in addition to running Cygwin programs,
runs a few native Windows executables (e.g. powershell.exe, windows
python.exe, some C++ binary that I've compiled for Windows [not
This works fine normally, except in random instances (I'd say it
happens maybe one out of every 30 runs), I observe the following:
1) The Cygwin bash script runs the native executable
2) The executable is properly located by bash and begins to run
(i.e., I can see output from the native windows program)
3) The native windows program successfully completes and exits with
code 0 internally
4) But -- the error code returned to the bash script is 127 --
despite no indication of an error anywhere
Here's an example:
# Run windows binary
# program is properly located and runs to completion with no errors
echo $? # maybe 1 out of 30 times this returns 127
This only happens with native binaries, including with one of my own
compiled (from C++) native windows .exe files in which I know for
certain that it is returning a zero error code.
So in other words, the bash script, despite having located and run the
native windows exe successfully, is still handed an error code of 127.
I realize that 127 usually means "Command not found" but that is not
the case here, because the native program always runs, and always runs
successfully (I verified this).
This happens randomly -- today I run the script a few times and it's
fine, then tomorrow I run it a few times (unchanged) and I observe
this issue on one of those runs. Furthermore, it only happens when
running the native windows binaries in the shell script (never happens
for Cygwin programs).
This is really mystifying me, I've searched all over but I can't find
anything. Does anyone have any idea? I could always setup my bash
script to ignore the 127 return code from invocations of native exes,
but I'd prefer to get to the bottom of it. Any ideas?
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple