summaryrefslogtreecommitdiff
path: root/tools/bit/main.cpp
diff options
context:
space:
mode:
authorChih-hung Hsieh <chh@google.com>2017-10-16 20:39:41 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-10-16 20:39:41 +0000
commite1e0785c38488a48e03d939508b89ba3cadc84cc (patch)
tree460dbd3e8d3d2ecda6c7be2b18d9bbf00961fd4b /tools/bit/main.cpp
parent7215f944016d58e69ce4f4dda1c70b9609b6faf9 (diff)
parentdecc397b267ca0769a2232ebaee6580bb082e0d1 (diff)
Merge "Use -Werror in frameworks/base" am: 16fbd3a1d8 am: 0bfb717a37 am: 9f004b1752
am: decc397b26 Change-Id: Id4abbc6cb95b2eb96f535b6c1c5295cb27c9d2b0
Diffstat (limited to 'tools/bit/main.cpp')
-rw-r--r--tools/bit/main.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/tools/bit/main.cpp b/tools/bit/main.cpp
index 91ca5143965e..a8a4cfcab351 100644
--- a/tools/bit/main.cpp
+++ b/tools/bit/main.cpp
@@ -596,6 +596,15 @@ check_device_property(const string& property, const string& expected)
}
}
+static void
+chdir_or_exit(const char *path) {
+ // TODO: print_command("cd", path);
+ if (0 != chdir(path)) {
+ print_error("Error: Could not chdir: %s", path);
+ exit(1);
+ }
+}
+
/**
* Run the build, install, and test actions.
*/
@@ -618,8 +627,7 @@ run_phases(vector<Target*> targets, const Options& options)
const string buildId = get_build_var(buildTop, "BUILD_ID", false);
const string buildOut = get_out_dir();
- // TODO: print_command("cd", buildTop.c_str());
- chdir(buildTop.c_str());
+ chdir_or_exit(buildTop.c_str());
// Get the modules for the targets
map<string,Module> modules;
@@ -999,7 +1007,7 @@ run_tab_completion(const string& word)
const string buildProduct = get_required_env("TARGET_PRODUCT", false);
const string buildOut = get_out_dir();
- chdir(buildTop.c_str());
+ chdir_or_exit(buildTop.c_str());
string buildDevice = sniff_device_name(buildOut, buildProduct);