Home

Capturing error output from the script running via LPRUN

edited January 2017
Hi

I have a master script, which runs several child scripts using lprun and Utils.Cmd (I prefer this method to Utils.Run as the latter is not very stable in my case and causes compilation conflicts when multiple child scripts are running in the loop). Unfortunately it seems I cannot have the exception information from child script, as the output array of Utils.Cmd is empty, and the exception thrown by the Utils.Cmd does not contain the original error.
		
		var result = "";
		try
		{
			var resArray = Util.Cmd("lprun.exe", childScript, false);
			//if the child script produces an error, then Util.Cmd throw an exception, so resArray is not populated.
			result = String.Join("\n", resArray);
		}
		catch (Exception ex)
		{
			//need to capture the error output here
			//ex and result do not contain the underlying error information
		}
Any idea how to capture the error output?


Comments

Sign In or Register to comment.