TODO(bernd-mesos): Refactor this into stout so that we can more easily chmod an executable. For example, we could define some static flags so that someone can do: os::chmod(path, EXECUTABLE_CHMOD_FLAGS).
| 264 | // chmod an executable. For example, we could define some static flags |
| 265 | // so that someone can do: os::chmod(path, EXECUTABLE_CHMOD_FLAGS). |
| 266 | static Try<string> chmodExecutable(const string& filePath) |
| 267 | { |
| 268 | // TODO(coffler): Fix Windows chmod handling, see MESOS-3176. |
| 269 | #ifndef __WINDOWS__ |
| 270 | Try<Nothing> chmod = os::chmod( |
| 271 | filePath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); |
| 272 | if (chmod.isError()) { |
| 273 | return Error("Failed to chmod executable '" + |
| 274 | filePath + "': " + chmod.error()); |
| 275 | } |
| 276 | #endif // __WINDOWS__ |
| 277 | |
| 278 | return filePath; |
| 279 | } |
| 280 | |
| 281 | |
| 282 | // Returns the resulting file or in case of extraction the destination |
no test coverage detected