Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: subprocess.cc

Issue 6880077: AU: Handle firmware update failure when booted from FW slot B. (Closed) Base URL: http://git.chromium.org/git/update_engine.git@master
Patch Set: Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « postinstall_runner_action_unittest.cc ('k') | update_attempter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 #include "update_engine/subprocess.h" 5 #include "update_engine/subprocess.h"
6 #include <stdlib.h> 6 #include <stdlib.h>
7 #include <string.h> 7 #include <string.h>
8 #include <string> 8 #include <string>
9 #include <unistd.h> 9 #include <unistd.h>
10 #include <vector> 10 #include <vector>
(...skipping 11 matching lines...) Expand all
22 SubprocessRecord* record = reinterpret_cast<SubprocessRecord*>(data); 22 SubprocessRecord* record = reinterpret_cast<SubprocessRecord*>(data);
23 23
24 // Make sure we read any remaining process output. Then close the pipe. 24 // Make sure we read any remaining process output. Then close the pipe.
25 GStdoutWatchCallback(record->gioout, G_IO_IN, &record->stdout); 25 GStdoutWatchCallback(record->gioout, G_IO_IN, &record->stdout);
26 int fd = g_io_channel_unix_get_fd(record->gioout); 26 int fd = g_io_channel_unix_get_fd(record->gioout);
27 g_source_remove(record->gioout_tag); 27 g_source_remove(record->gioout_tag);
28 g_io_channel_unref(record->gioout); 28 g_io_channel_unref(record->gioout);
29 close(fd); 29 close(fd);
30 30
31 g_spawn_close_pid(pid); 31 g_spawn_close_pid(pid);
32 gint use_status = status;
33 if (WIFEXITED(status))
34 use_status = WEXITSTATUS(status);
35
32 if (status) { 36 if (status) {
33 LOG(INFO) << "Subprocess status: " << status; 37 LOG(INFO) << "Subprocess status: " << use_status;
34 } 38 }
35 if (!record->stdout.empty()) { 39 if (!record->stdout.empty()) {
36 LOG(INFO) << "Subprocess output:\n" << record->stdout; 40 LOG(INFO) << "Subprocess output:\n" << record->stdout;
37 } 41 }
38 if (record->callback) { 42 if (record->callback) {
39 record->callback(status, record->stdout, record->callback_data); 43 record->callback(use_status, record->stdout, record->callback_data);
40 } 44 }
41 Get().subprocess_records_.erase(record->tag); 45 Get().subprocess_records_.erase(record->tag);
42 } 46 }
43 47
44 void Subprocess::GRedirectStderrToStdout(gpointer user_data) { 48 void Subprocess::GRedirectStderrToStdout(gpointer user_data) {
45 dup2(1, 2); 49 dup2(1, 2);
46 } 50 }
47 51
48 gboolean Subprocess::GStdoutWatchCallback(GIOChannel* source, 52 gboolean Subprocess::GStdoutWatchCallback(GIOChannel* source,
49 GIOCondition condition, 53 GIOCondition condition,
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 it != subprocess_records_.end(); ++it) { 231 it != subprocess_records_.end(); ++it) {
228 if (it->second->callback) 232 if (it->second->callback)
229 return true; 233 return true;
230 } 234 }
231 return false; 235 return false;
232 } 236 }
233 237
234 Subprocess* Subprocess::subprocess_singleton_ = NULL; 238 Subprocess* Subprocess::subprocess_singleton_ = NULL;
235 239
236 } // namespace chromeos_update_engine 240 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « postinstall_runner_action_unittest.cc ('k') | update_attempter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698