OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ |
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 return false; | 56 return false; |
57 } | 57 } |
58 private: | 58 private: |
59 // The global instance | 59 // The global instance |
60 static Subprocess* subprocess_singleton_; | 60 static Subprocess* subprocess_singleton_; |
61 | 61 |
62 // Callback for when any subprocess terminates. This calls the user | 62 // Callback for when any subprocess terminates. This calls the user |
63 // requested callback. | 63 // requested callback. |
64 static void GChildExitedCallback(GPid pid, gint status, gpointer data); | 64 static void GChildExitedCallback(GPid pid, gint status, gpointer data); |
65 | 65 |
| 66 // Callback which runs in the child before exec to redirect stderr onto |
| 67 // stdout. |
| 68 static void GRedirectStderrToStdout(gpointer user_data); |
| 69 |
66 struct SubprocessCallbackRecord { | 70 struct SubprocessCallbackRecord { |
67 ExecCallback callback; | 71 ExecCallback callback; |
68 void* callback_data; | 72 void* callback_data; |
69 }; | 73 }; |
70 | 74 |
71 std::map<int, SubprocessCallbackRecord> callback_records_; | 75 std::map<int, SubprocessCallbackRecord> callback_records_; |
72 | 76 |
73 Subprocess() {} | 77 Subprocess() {} |
74 DISALLOW_COPY_AND_ASSIGN(Subprocess); | 78 DISALLOW_COPY_AND_ASSIGN(Subprocess); |
75 }; | 79 }; |
76 | 80 |
77 } // namespace chromeos_update_engine | 81 } // namespace chromeos_update_engine |
78 | 82 |
79 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ | 83 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_SUBPROCESS_H__ |
OLD | NEW |