OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "platform/globals.h" | 5 #include "platform/globals.h" |
6 #if defined(TARGET_OS_WINDOWS) | 6 #if defined(TARGET_OS_WINDOWS) |
7 | 7 |
8 #include <process.h> // NOLINT | 8 #include <process.h> // NOLINT |
9 | 9 |
10 #include "bin/builtin.h" | 10 #include "bin/builtin.h" |
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 } | 820 } |
821 } | 821 } |
822 | 822 |
823 // All handles closed and all data read. | 823 // All handles closed and all data read. |
824 result->set_stdout_data(oh[0].GetData()); | 824 result->set_stdout_data(oh[0].GetData()); |
825 result->set_stderr_data(oh[1].GetData()); | 825 result->set_stderr_data(oh[1].GetData()); |
826 | 826 |
827 // Calculate the exit code. | 827 // Calculate the exit code. |
828 ASSERT(oh[2].GetDataSize() == 8); | 828 ASSERT(oh[2].GetDataSize() == 8); |
829 uint32_t exit[2]; | 829 uint32_t exit[2]; |
830 memcpy(&exit, oh[2].GetFirstDataBuffer(), sizeof(exit)); | 830 memmove(&exit, oh[2].GetFirstDataBuffer(), sizeof(exit)); |
831 oh[2].FreeDataBuffer(); | 831 oh[2].FreeDataBuffer(); |
832 intptr_t exit_code = exit[0]; | 832 intptr_t exit_code = exit[0]; |
833 intptr_t negative = exit[1]; | 833 intptr_t negative = exit[1]; |
834 if (negative) exit_code = -exit_code; | 834 if (negative) exit_code = -exit_code; |
835 result->set_exit_code(exit_code); | 835 result->set_exit_code(exit_code); |
836 return true; | 836 return true; |
837 } | 837 } |
838 | 838 |
839 | 839 |
840 bool Process::Kill(intptr_t id, int signal) { | 840 bool Process::Kill(intptr_t id, int signal) { |
(...skipping 18 matching lines...) Expand all Loading... |
859 | 859 |
860 | 860 |
861 intptr_t Process::CurrentProcessId() { | 861 intptr_t Process::CurrentProcessId() { |
862 return static_cast<intptr_t>(GetCurrentProcessId()); | 862 return static_cast<intptr_t>(GetCurrentProcessId()); |
863 } | 863 } |
864 | 864 |
865 } // namespace bin | 865 } // namespace bin |
866 } // namespace dart | 866 } // namespace dart |
867 | 867 |
868 #endif // defined(TARGET_OS_WINDOWS) | 868 #endif // defined(TARGET_OS_WINDOWS) |
OLD | NEW |