# Executing the output from a C++ install task

**URL:** https://discuss.gradle.org/t/executing-the-output-from-a-c-install-task/12386
**Category:** Help/Discuss
**Created:** [October 23, 2015, 12:12pm UTC](https://discuss.gradle.org/t/executing-the-output-from-a-c-install-task/12386 "2015-10-23T12:12:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![tom\_wright](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/tom_wright/32/2651_2.png) [@tom\_wright](https://discuss.gradle.org/u/tom_wright)
#### Post date: [October 23, 2015, 12:12pm UTC](https://discuss.gradle.org/t/executing-the-output-from-a-c-install-task/12386/1 "2015-10-23T12:12:46Z")

</div>

I’ve been using Gradle 2.5 for a multi-project C++ build, and want to run some of the executables created by my build as an additional task within the build. With 2.5, the following approach worked:  
`
binaries.withType(NativeExecutableBinarySpec) { spec ->
spec.tasks.matching { task -> task.name.startsWith( ‘install’ ) }.each { installTask ->
// Create an Exec task instance to actually run the exe (and DLLs)
// collected together by the install task
}
}
`  
However, in Gradle 2.6 and later, this no longer works - no ‘install\*’ tasks are found by the matching filter. If I instead use  
`
binaries.withType(NativeExecutableBinarySpec) { spec ->
project.tasks.matching{ task -> task.name.startsWith( ‘install’ ) }.whenTaskAdded{ … }
}
`  
then I find the tasks, but my closure executes before the ‘executable’ property is set, so I get a null pointer exception when trying to identify the exe to actually run in the Exec task.

What has changed here, and how should I change my build script to work with Gradle 2.6 and newer?
