diff options
author | 2017-02-01 15:09:58 -0800 | |
---|---|---|
committer | 2017-02-01 15:51:42 -0800 | |
commit | 97c381e3ce34cd327c2ec35fa850bd0eaa9b697f (patch) | |
tree | 4a21b2db89c578cdb2908547547e0546748eec7f /runtime/exec_utils.h | |
parent | 3cb871ab1af47576959fd24a99d370381b8f193e (diff) |
Separate art::Exec from utils
The rest of utils.cc does not depend on art::Runtime. This separates
the part dependent on that class, so that including utils.cc in the
build does not require the entire Runtime. Another preparatory cleanup
to getting tools to build on Windows.
Bug: 22322814
Test: test-art
Change-Id: I194ff363fc2ab87e5311ecea6973a2d0fad2621d
Diffstat (limited to 'runtime/exec_utils.h')
-rw-r--r-- | runtime/exec_utils.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/runtime/exec_utils.h b/runtime/exec_utils.h new file mode 100644 index 0000000000..093f7b8d80 --- /dev/null +++ b/runtime/exec_utils.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef ART_RUNTIME_EXEC_UTILS_H_ +#define ART_RUNTIME_EXEC_UTILS_H_ + +#include <string> +#include <vector> + +namespace art { + +// Wrapper on fork/execv to run a command in a subprocess. +// Both of these spawn child processes using the environment as it was set when the single instance +// of the runtime (Runtime::Current()) was started. If no instance of the runtime was started, it +// will use the current environment settings. +bool Exec(std::vector<std::string>& arg_vector, std::string* error_msg); +int ExecAndReturnCode(std::vector<std::string>& arg_vector, std::string* error_msg); + +} // namespace art + +#endif // ART_RUNTIME_EXEC_UTILS_H_ |