summaryrefslogtreecommitdiff
path: root/tools/bit/main.cpp
diff options
context:
space:
mode:
author Chih-hung Hsieh <chh@google.com> 2017-10-16 19:13:22 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2017-10-16 19:13:22 +0000
commit16fbd3a1d821a375abbc23749b891489aecd53d7 (patch)
tree65ca6d2403f5d5b8981d35abb514517401570a7b /tools/bit/main.cpp
parentce1f9afb842555982474f8ef7a3d4f19257f5a8a (diff)
parentc7edf078f92c7ce083f8c243a79f8aecdfff4ac1 (diff)
Merge "Use -Werror in frameworks/base"
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 d056ba53ca84..ad23971152b2 100644
--- a/tools/bit/main.cpp
+++ b/tools/bit/main.cpp
@@ -561,6 +561,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.
*/
@@ -583,8 +592,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;
@@ -952,7 +960,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);