OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 24 matching lines...) Expand all Loading... |
35 ChildLauncher(const std::wstring& executable, | 35 ChildLauncher(const std::wstring& executable, |
36 const std::wstring& command_line); | 36 const std::wstring& command_line); |
37 | 37 |
38 ~ChildLauncher(); | 38 ~ChildLauncher(); |
39 | 39 |
40 //! \brief Starts the child process, after which the handle functions below | 40 //! \brief Starts the child process, after which the handle functions below |
41 //! will be valid. | 41 //! will be valid. |
42 void Start(); | 42 void Start(); |
43 | 43 |
44 //! \brief Waits for the child process to exit. | 44 //! \brief Waits for the child process to exit. |
45 //! | 45 //! |
46 //! \return The process exit code. | 46 //! \return The process exit code. |
47 DWORD WaitForExit(); | 47 DWORD WaitForExit(); |
48 | 48 |
49 //! \brief The child process's `HANDLE`. | 49 //! \brief The child process's `HANDLE`. |
50 HANDLE process_handle() const { return process_handle_.get(); } | 50 HANDLE process_handle() const { return process_handle_.get(); } |
51 | 51 |
52 //! \brief The child process's main thread's `HANDLE`. | 52 //! \brief The child process's main thread's `HANDLE`. |
53 HANDLE main_thread_handle() const { return main_thread_handle_.get(); } | 53 HANDLE main_thread_handle() const { return main_thread_handle_.get(); } |
54 | 54 |
55 //! \brief The read end of a pipe attached to the child's stdout. | 55 //! \brief The read end of a pipe attached to the child's stdout. |
56 HANDLE stdout_read_handle() const { return stdout_read_handle_.get(); } | 56 HANDLE stdout_read_handle() const { return stdout_read_handle_.get(); } |
57 | 57 |
58 //! \brief The write end of a pipe attached to the child's stdin. | 58 //! \brief The write end of a pipe attached to the child's stdin. |
59 HANDLE stdin_write_handle() const { return stdin_write_handle_.get(); } | 59 HANDLE stdin_write_handle() const { return stdin_write_handle_.get(); } |
60 | 60 |
61 private: | 61 private: |
62 std::wstring executable_; | 62 std::wstring executable_; |
63 std::wstring command_line_; | 63 std::wstring command_line_; |
64 ScopedKernelHANDLE process_handle_; | 64 ScopedKernelHANDLE process_handle_; |
65 ScopedKernelHANDLE main_thread_handle_; | 65 ScopedKernelHANDLE main_thread_handle_; |
66 ScopedFileHANDLE stdout_read_handle_; | 66 ScopedFileHANDLE stdout_read_handle_; |
67 ScopedFileHANDLE stdin_write_handle_; | 67 ScopedFileHANDLE stdin_write_handle_; |
68 }; | 68 }; |
69 | 69 |
70 //! \brief Utility function for building escaped command lines. | |
71 //! | |
72 //! \param[in] argument Appended to \a command_line surrounded by properly | |
73 //! escaped quotation marks, if necessary. | |
74 //! \param[inout] command_line The command line being constructed. | |
75 void AppendCommandLineArgument(const std::wstring& argument, | |
76 std::wstring* command_line); | |
77 | |
78 } // namespace test | 70 } // namespace test |
79 } // namespace crashpad | 71 } // namespace crashpad |
80 | 72 |
81 #endif // CRASHPAD_TEST_WIN_CHILD_LAUNCHER_H_ | 73 #endif // CRASHPAD_TEST_WIN_CHILD_LAUNCHER_H_ |
OLD | NEW |