/// <summary> /// Manage and log output to properties /// </summary> protected virtual void ManageOutput() { StandardOutput.Trim(); StandardError.Trim(); }
protected override void ManageOutput() { //PAExec does not return standard error only Exit Codes. This interpuates the exit code and adds it to the standard error out. if (ExitCode < 0) { var errorData = string.Format("PAEXEC Error {0}: ", ExitCode); if (ExitCode == -1) { errorData += "internal error"; } if (ExitCode == -2) { errorData += "command line error"; } if (ExitCode == -3) { errorData += "failed to launch app (locally)"; } if (ExitCode == -4) { errorData += "failed to copy PAExec to remote (connection to ADMIN$ might have failed)"; } if (ExitCode == -5) { errorData += "connection to server taking too long (timeout)"; } if (ExitCode == -6) { errorData += "PAExec service could not be installed/started on remote server"; } if (ExitCode == -7) { errorData += "could not communicate with remote PAExec service"; } if (ExitCode == -8) { errorData += "failed to copy app to remote server"; } if (ExitCode == -9) { errorData += "failed to launch app (remotely)"; } if (ExitCode == -10) { errorData += "app was terminated after timeout expired"; } if (ExitCode == -11) { errorData += "forcibly stopped with Ctrl-C / Ctrl-Break"; } nlog.Error("[PAExec Arguments] {1}{0}[StandardError]{0}{2}{0}[StandardOutput]{0}{3}{0}[Exit Code] {4}", System.Environment.NewLine, StartInfo.Arguments, StandardError, StandardOutput, errorData); Log(log.Error, errorData); } else if (ExitCode > 0) { if (_arguments.Contains("RMDIR") && StandardError.Contains("The system cannot find the file specified")) { nlog.Warn("[PAExec Arguments] {1}{0}[StandardError]{0}{2}{0}[StandardOutput]{0}{3}{0}[Exit Code] {4}", System.Environment.NewLine, StartInfo.Arguments, StandardError, StandardOutput, ExitCode); Log(log.Warn, StandardError = string.Format("PAExec ran but command returned error {0} -- {1} --", ExitCode, StandardError.Trim())); } else { nlog.Error("[PAExec Arguments] {1}{0}[StandardError]{0}{2}{0}[StandardOutput]{0}{3}{0}[Exit Code] {4}", System.Environment.NewLine, StartInfo.Arguments, StandardError, StandardOutput, ExitCode); Log(log.Error, StandardError = string.Format("PAExec ran but command returned error {0} -- {1} --", ExitCode, StandardError.Trim())); } } }
public bool PAExec(string arguments) { Program = "paexec.exe"; execute(Px_Arguments(arguments)); if (ExitCode == 0) { return(true); } else if (ExitCode < 0) { StandardError += string.Format("| PAEXEC Error {0}: ", ExitCode); if (ExitCode == -1) { StandardError += "internal error"; } if (ExitCode == -2) { StandardError += "command line error"; } if (ExitCode == -3) { StandardError += "failed to launch app (locally)"; } if (ExitCode == -4) { StandardError += "failed to copy PAExec to remote (connection to ADMIN$ might have failed)"; } if (ExitCode == -5) { StandardError += "connection to server taking too long (timeout)"; } if (ExitCode == -6) { StandardError += "PAExec service could not be installed/started on remote server"; } if (ExitCode == -7) { StandardError += "could not communicate with remote PAExec service"; } if (ExitCode == -8) { StandardError += "failed to copy app to remote server"; } if (ExitCode == -9) { StandardError += "failed to launch app (remotely)"; } if (ExitCode == -10) { StandardError += "app was terminated after timeout expired"; } if (ExitCode == -11) { StandardError += "forcibly stopped with Ctrl-C / Ctrl-Break"; } log.Error(StandardError); return(false); } else if (ExitCode > 0) { log.Error(StandardError = string.Format("Program ran but returned error {0}: {1}", ExitCode, StandardError.Trim())); return(false); } log.Fatal(StandardError += " <--is some crazy shit that happend and I failed to process it."); return(false); }