I am writing a tool written in python and C. A Python script reads a configuration file, performs some verification, makes several calls in the C program.
: RHE 5.7, python: 2.7.6, gcc: 4.5.2
Some of the parameters of the called C program are input file paths. There is one case where the input file path is the same for several C program calls. In this case, only the first call is made, and the return code from the python subprocess module is -11.
I am not sure how to do this. For starters, I canβt find any documentation indicating that β-11β can mean exit status. It doesn't seem to be in the "standard" codes in /usr/include/sysexits.h. I assume that the code can also be interpreted as 0xf5 or 245, since I consider the exit codes to be truly signed 8-bit values.
I added debugging to the beginning of C to print the arguments with which it was called, but nothing is displayed for failed calls. I can understand how C may not repeat opening the file that was read in the previous call (maybe), but the code does not even get there!
So where does the exit code come from? Is this from an environment (bash) that the python subprocess module apparently uses to invoke the C program? Is it from C runtime to C program before it even reaches the core?
I suppose I could advance this by moving the "loop" down in C so that it is called only once for each path of the input file, but this still does not explain this behavior. Can someone explain how I can determine the cause of this error? Thanks.
(FWIW) calling from python:
try: subprocess.check_call( args ) except subprocess.CalledProcessError as e: print e
Log in to C:
printf( "\n--- swizzle\n\nargs:\n" ); for ( int i = 0; i < argc; i++ ) printf( "- %s\n", argv[ i ]);
Error output:
Command '[..]' returned non-zero exit status -11