Skip to content

Commit 4e74290

Browse files
committed
Make sure to pass environment to scan-build
1 parent 95bc877 commit 4e74290

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/main/java/jenkins/plugins/clangscanbuild/commands/BuildContextImpl.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
package jenkins.plugins.clangscanbuild.commands;
22

3+
import hudson.EnvVars;
34
import hudson.FilePath;
45
import hudson.Launcher;
56
import hudson.Launcher.ProcStarter;
67
import hudson.model.BuildListener;
78
import hudson.model.AbstractBuild;
89
import hudson.util.ArgumentListBuilder;
10+
import hudson.model.TaskListener;
911

1012
import java.io.IOException;
1113

@@ -49,7 +51,17 @@ public FilePath getBuildFolder() {
4951

5052
@Override
5153
public int waitForProcess( FilePath presentWorkingDirectory, ArgumentListBuilder command ){
54+
5255
ProcStarter procStarter = launcher.launch();
56+
try {
57+
final EnvVars buildEnvironment = build.getEnvironment( TaskListener.NULL );
58+
procStarter.envs( buildEnvironment );
59+
} catch (IOException e) {
60+
log( "Error getting environment: " + e.getMessage() );
61+
} catch (InterruptedException e) {
62+
log( "Interrupted when getting environment: " + e.getMessage() );
63+
}
64+
5365
procStarter.pwd( presentWorkingDirectory );
5466
procStarter.stdout( listener ); // maps output from command to console output. Some commands will need to override this because they need to capture the output.
5567
procStarter.cmds( command );

0 commit comments

Comments
 (0)