<commit_before>package com.zend.zendserver.bamboo.Process;

import java.io.File;

import com.atlassian.bamboo.build.logger.BuildLogger;
import com.atlassian.utils.process.ExternalProcess;
import com.atlassian.utils.process.ExternalProcessBuilder;
import com.atlassian.utils.process.PluggableProcessHandler;
import com.zend.zendserver.bamboo.Env.BuildEnv;

public class ProcessHandler {
	public Process process;
	private ExternalProcess externalProcess;
	private PluggableProcessHandler processHandler;
	private BuildLogger buildLogger;
	
	private Boolean failed = false;
	private BuildEnv buildEnv;
	
	public ProcessHandler(Process process, BuildLogger buildLogger)
    {
		this.process = process;
		this.buildLogger = buildLogger;
		
		this.processHandler = new PluggableProcessHandler();
    }
	
	public ExternalProcess getExternalProcess() {
		return externalProcess;
	}
	
	protected ExternalProcessBuilder getProcessBuilder() throws Exception {
		ExternalProcessBuilder epb = new ExternalProcessBuilder()
			.command(process.getCommandList())
			.handler(processHandler);
		return epb;
	}
	
	public void execute() {
		try {
			OutputHandler outputHandler = new OutputHandler(processHandler, getOutputFilename(), buildLogger);
			process.getCommandList();
			externalProcess = getProcessBuilder().build();
			externalProcess.execute();
			buildLogger.addBuildLogEntry("Process command line: " + externalProcess.getCommandLine());
	        
	        outputHandler.write();
		}
		catch (Exception e) {
			buildLogger.addErrorLogEntry("Exception in ProcessHandler.execute function");
			buildLogger.addErrorLogEntry(e.getMessage());
			failed = true;
		}
	}
	
	public Boolean hasFailed() {
		if (!failed) {
			failed = !processHandler.succeeded();
		}
		<commit_msg>set env var RAW_ZS_OUTPUT, so that only XML returned by ZS is validated (no extra information from Zend ServerSDK)<commit_after>package com.zend.zendserver.bamboo.Process;

import java.io.File;

import com.atlassian.bamboo.build.logger.BuildLogger;
import com.atlassian.utils.process.ExternalProcess;
import com.atlassian.utils.process.ExternalProcessBuilder;
import com.atlassian.utils.process.PluggableProcessHandler;
import com.zend.zendserver.bamboo.Env.BuildEnv;

public class ProcessHandler {
	public Process process;
	private ExternalProcess externalProcess;
	private PluggableProcessHandler processHandler;
	private BuildLogger buildLogger;
	
	private Boolean failed = false;
	private BuildEnv buildEnv;
	
	public ProcessHandler(Process process, BuildLogger buildLogger)
    {
		this.process = process;
		this.buildLogger = buildLogger;
		
		this.processHandler = new PluggableProcessHandler();
    }
	
	public ExternalProcess getExternalProcess() {
		return externalProcess;
	}
	
	protected ExternalProcessBuilder getProcessBuilder() throws Exception {
		ExternalProcessBuilder epb = new ExternalProcessBuilder()
			.command(process.getCommandList())
			.env("RAW_ZS_OUTPUT", "1")
			.handler(processHandler);
		return epb;
	}
	
	public void execute() {
		try {
			OutputHandler outputHandler = new OutputHandler(processHandler, getOutputFilename(), buildLogger);
			process.getCommandList();
			externalProcess = getProcessBuilder().build();
			externalProcess.execute();
			buildLogger.addBuildLogEntry("Process command line: " + externalProcess.getCommandLine());
	        
	        outputHandler.write();
		}
		catch (Exception e) {
			buildLogger.addErrorLogEntry("Exception in ProcessHandler.execute function");
			buildLogger.addErrorLogEntry(e.getMessage());
			failed = true;
		}
	}
	
	public Boolean hasFailed() {
		if (!failed) {
			failed = !processHandler.succeeded();
		}
		
{'fraction_non_alphanumeric': 0.09200109200109201, 'fraction_numerical': 0.000273000273000273, 'mean_word_length': 5.016420361247947, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3316638', 'n_tokens_mistral': 1125, 'n_tokens_neox': 995, 'n_words': 224}