diff options
author | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 22:21:56 +0000 |
---|---|---|
committer | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-13 22:21:56 +0000 |
commit | 8dfaada9fa663cf78e3eaad3ae3c146e3b60cd4d (patch) | |
tree | 7d6351e723bfd992bfd7d6b6ef70442baa90d53a | |
parent | 955a8b41fc85963b776291ef7a07643527640b43 (diff) | |
download | chromium_src-8dfaada9fa663cf78e3eaad3ae3c146e3b60cd4d.zip chromium_src-8dfaada9fa663cf78e3eaad3ae3c146e3b60cd4d.tar.gz chromium_src-8dfaada9fa663cf78e3eaad3ae3c146e3b60cd4d.tar.bz2 |
[NaCl SDK] Add exit code to ppapi_simple's PS_EXIT_MESSAGE.
R=binji@chromium.org
Review URL: https://codereview.chromium.org/69333002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@234927 0039d316-1c4b-4281-b951-d872f2087c98
4 files changed, 9 insertions, 14 deletions
diff --git a/native_client_sdk/src/libraries/ppapi_simple/ps_instance.cc b/native_client_sdk/src/libraries/ppapi_simple/ps_instance.cc index a7dffc7..a4b0d41 100644 --- a/native_client_sdk/src/libraries/ppapi_simple/ps_instance.cc +++ b/native_client_sdk/src/libraries/ppapi_simple/ps_instance.cc @@ -65,16 +65,15 @@ void* PSInstance::MainThreadThunk(void *info) { int ret = si->inst_->MainThread(si->argc_, si->argv_); - char* exit_message = si->inst_->exit_message_; - bool should_exit = exit_message == NULL; + bool should_exit = si->inst_->exit_message_ == NULL; - if (exit_message) { + if (si->inst_->exit_message_) { // Send the exit message to JavaScript. Don't call exit(), so the message // doesn't get dropped. si->inst_->Log("Posting exit message to JavaScript.\n"); - si->inst_->PostMessage(exit_message); - free(exit_message); - exit_message = si->inst_->exit_message_ = NULL; + std::stringstream ss; + ss << si->inst_->exit_message_ << ":" << ret; + si->inst_->PostMessage(ss.str()); } // Clean up StartInfo. @@ -84,7 +83,6 @@ void* PSInstance::MainThreadThunk(void *info) { delete[] si->argv_; delete si; - if (should_exit) { // Exit the entire process once the 'main' thread returns. // The error code will be available to javascript via @@ -267,10 +265,7 @@ bool PSInstance::ProcessProperties() { } } - const char* exit_message = getenv("PS_EXIT_MESSAGE"); - if (exit_message) { - exit_message_ = strdup(exit_message); - } + exit_message_ = getenv("PS_EXIT_MESSAGE"); // Set line buffering on stdout and stderr #if !defined(WIN32) diff --git a/native_client_sdk/src/tests/nacl_io_socket_test/example.js b/native_client_sdk/src/tests/nacl_io_socket_test/example.js index 8b95dbf..24b8243 100644 --- a/native_client_sdk/src/tests/nacl_io_socket_test/example.js +++ b/native_client_sdk/src/tests/nacl_io_socket_test/example.js @@ -44,7 +44,7 @@ function endCommand(testName, testResult) { testResultEl.textContent = testResult; } -function testendCommand() { +function testendCommand(exitCode) { testsFinished = true; if (failedTests) { diff --git a/native_client_sdk/src/tests/nacl_io_test/example.js b/native_client_sdk/src/tests/nacl_io_test/example.js index 8b95dbf..24b8243 100644 --- a/native_client_sdk/src/tests/nacl_io_test/example.js +++ b/native_client_sdk/src/tests/nacl_io_test/example.js @@ -44,7 +44,7 @@ function endCommand(testName, testResult) { testResultEl.textContent = testResult; } -function testendCommand() { +function testendCommand(exitCode) { testsFinished = true; if (failedTests) { diff --git a/native_client_sdk/src/tests/sdk_util_test/example.js b/native_client_sdk/src/tests/sdk_util_test/example.js index 8b95dbf..24b8243 100644 --- a/native_client_sdk/src/tests/sdk_util_test/example.js +++ b/native_client_sdk/src/tests/sdk_util_test/example.js @@ -44,7 +44,7 @@ function endCommand(testName, testResult) { testResultEl.textContent = testResult; } -function testendCommand() { +function testendCommand(exitCode) { testsFinished = true; if (failedTests) { |