Browse Source

Added process reader/writer exit code.

Branimir Karadžić 9 years ago
parent
commit
e0b1d2a204
1 changed files with 14 additions and 2 deletions
  1. 14 2
      include/bx/crtimpl.h

+ 14 - 2
include/bx/crtimpl.h

@@ -256,7 +256,7 @@ namespace bx
 		virtual void close() BX_OVERRIDE
 		{
 			BX_CHECK(NULL != m_file, "Process not open!");
-			pclose(m_file);
+			m_exitCode = pclose(m_file);
 			m_file = NULL;
 		}
 
@@ -282,8 +282,14 @@ namespace bx
 			return size;
 		}
 
+		int32_t getExitCode() const
+		{
+			return m_exitCode;
+		}
+
 	private:
 		FILE* m_file;
+		int32_t m_exitCode;
 	};
 
 	class ProcessWriter : public WriterOpenI, public CloserI, public WriterI
@@ -316,7 +322,7 @@ namespace bx
 		virtual void close() BX_OVERRIDE
 		{
 			BX_CHECK(NULL != m_file, "Process not open!");
-			pclose(m_file);
+			m_exitCode = pclose(m_file);
 			m_file = NULL;
 		}
 
@@ -338,8 +344,14 @@ namespace bx
 			return size;
 		}
 
+		int32_t getExitCode() const
+		{
+			return m_exitCode;
+		}
+
 	private:
 		FILE* m_file;
+		int32_t m_exitCode;
 	};
 
 #endif // BX_CONFIG_CRT_PROCESS