Home » Extra libraries, Code snippets, applications etc. » OS Problems etc., Win32, POSIX, MacOS, FreeBSD, X11 etc » [solved] Linux LocalProcess::GetExitCode highly divergent from Windows
[solved] Linux LocalProcess::GetExitCode highly divergent from Windows [message #48734] |
Sat, 02 September 2017 10:55 |
cbpporter
Messages: 1401 Registered: September 2007
|
Ultimate Contributor |
|
|
Under Linux, LocalPRocess does not give me the exact exit code the child process gave.
Created this sample app duo:
lpchild package:
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
SetExitCode(-42);
Cout() << "Exited with " << GetExitCode() << "!\n";
}
lpparent package:
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
LocalProcess lp("lpchild");
String t, tt;
while (lp.Read(t)) {
if (t.GetCount())
tt << t;
}
Cout() << "Child said:\n";
Cout() << tt;
Cout() << "Child exited with: " << lp.GetExitCode() << "\n";
}
output:
Child said:
Exited with -42!
Child exited with: 214
I saw no other API member that could give the real code.
[Updated on: Sat, 02 September 2017 11:26] Report message to a moderator
|
|
|
Re: Linux LocalProcess::GetExitCode highly divergent from Windows [message #48735 is a reply to message #48734] |
Sat, 02 September 2017 11:21 |
cbpporter
Messages: 1401 Registered: September 2007
|
Ultimate Contributor |
|
|
OK, looks like this is not an U++ issue but a standard Linux limitation. Return codes are 8 bit. Welcome to 2017!
I guess I need to come up with a standardized API to report error across Linux and Windows, because 0 is valid on Linux, but other positives are error and positives are success on Windows...
|
|
|
Goto Forum:
Current Time: Thu Mar 28 19:11:49 CET 2024
Total time taken to generate the page: 0.01737 seconds
|