mirror of
https://github.com/arun11299/cpp-subprocess.git
synced 2025-08-04 12:26:19 -04:00
msvc: Fix "warning C4101: 'status': unreferenced local variable" (#94)
This change is required to build downstream projects using MSVC with the `/WX` compiler option. No behavior changes.
This commit is contained in:
parent
46d2b244c4
commit
d19cce111c
@ -1427,8 +1427,6 @@ inline int Popen::wait() noexcept(false)
|
|||||||
|
|
||||||
inline int Popen::poll() noexcept(false)
|
inline int Popen::poll() noexcept(false)
|
||||||
{
|
{
|
||||||
int status;
|
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _MSC_VER
|
||||||
if (!child_created_) return -1; // TODO: ??
|
if (!child_created_) return -1; // TODO: ??
|
||||||
#endif
|
#endif
|
||||||
@ -1436,13 +1434,7 @@ inline int Popen::poll() noexcept(false)
|
|||||||
#ifdef __USING_WINDOWS__
|
#ifdef __USING_WINDOWS__
|
||||||
int ret = WaitForSingleObject(process_handle_, 0);
|
int ret = WaitForSingleObject(process_handle_, 0);
|
||||||
if (ret != WAIT_OBJECT_0) return -1;
|
if (ret != WAIT_OBJECT_0) return -1;
|
||||||
#else
|
|
||||||
// Returns zero if child is still running
|
|
||||||
int ret = waitpid(child_pid_, &status, WNOHANG);
|
|
||||||
if (ret == 0) return -1;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __USING_WINDOWS__
|
|
||||||
DWORD dretcode_;
|
DWORD dretcode_;
|
||||||
if (FALSE == GetExitCodeProcess(process_handle_, &dretcode_))
|
if (FALSE == GetExitCodeProcess(process_handle_, &dretcode_))
|
||||||
throw OSError("GetExitCodeProcess", 0);
|
throw OSError("GetExitCodeProcess", 0);
|
||||||
@ -1452,6 +1444,12 @@ inline int Popen::poll() noexcept(false)
|
|||||||
|
|
||||||
return retcode_;
|
return retcode_;
|
||||||
#else
|
#else
|
||||||
|
int status;
|
||||||
|
|
||||||
|
// Returns zero if child is still running
|
||||||
|
int ret = waitpid(child_pid_, &status, WNOHANG);
|
||||||
|
if (ret == 0) return -1;
|
||||||
|
|
||||||
if (ret == child_pid_) {
|
if (ret == child_pid_) {
|
||||||
if (WIFSIGNALED(status)) {
|
if (WIFSIGNALED(status)) {
|
||||||
retcode_ = WTERMSIG(status);
|
retcode_ = WTERMSIG(status);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user