diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/selftest.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/selftest.cpp b/src/selftest.cpp index a9c73fe..dc9936e 100644 --- a/src/selftest.cpp +++ b/src/selftest.cpp | |||
| @@ -10,6 +10,9 @@ | |||
| 10 | #include "bip32.h" | 10 | #include "bip32.h" |
| 11 | #include "proxy.h" | 11 | #include "proxy.h" |
| 12 | #include "selftest.h" | 12 | #include "selftest.h" |
| 13 | #ifndef _WIN32 | ||
| 14 | #include <sys/wait.h> // WIFEXITED/WEXITSTATUS for the child-process helper | ||
| 15 | #endif | ||
| 13 | #include "sockcount.h" | 16 | #include "sockcount.h" |
| 14 | #include "tor.h" | 17 | #include "tor.h" |
| 15 | #include "walletcmd.h" | 18 | #include "walletcmd.h" |
| @@ -2110,7 +2113,13 @@ static int RunBitflashChild(const string& strExe, | |||
| 2110 | strCmd += " > " + QuoteCommandArg(*pOutputFile) + " 2>&1"; | 2113 | strCmd += " > " + QuoteCommandArg(*pOutputFile) + " 2>&1"; |
| 2111 | else | 2114 | else |
| 2112 | strCmd += " > /dev/null 2>&1"; | 2115 | strCmd += " > /dev/null 2>&1"; |
| 2113 | return system(strCmd.c_str()); | 2116 | // system() returns a wait status, not the exit code; unwrap it so callers |
| 2117 | // see the same value the Windows _spawnv path returns (e.g. exit code 2 is | ||
| 2118 | // 2, not 512). Without this every "== 2" assertion fails only on Linux. | ||
| 2119 | int nSysRet = system(strCmd.c_str()); | ||
| 2120 | if (nSysRet != -1 && WIFEXITED(nSysRet)) | ||
| 2121 | return WEXITSTATUS(nSysRet); | ||
| 2122 | return nSysRet; | ||
| 2114 | #endif | 2123 | #endif |
| 2115 | } | 2124 | } |
| 2116 | 2125 | ||