diff --git a/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GetAzureHDInsightJobOutputCmdlet.cs b/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GetAzureHDInsightJobOutputCmdlet.cs index 2fc8ef42facc..ab9cf7f0b5ec 100644 --- a/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GetAzureHDInsightJobOutputCmdlet.cs +++ b/src/ServiceManagement/HDInsight/Commands.HDInsight/Cmdlet/GetAzureHDInsightJobOutputCmdlet.cs @@ -136,21 +136,39 @@ protected override void EndProcessing() this.command.CurrentSubscription = this.GetCurrentSubscription(this.Subscription, this.Certificate); this.AssertTaskLogsDirectorySpecified(this.TaskLogsDirectory); - if (this.StandardError.IsPresent) + int numSpecifiedOutputTypes = 0; + string selectedOutputType = "Standard Output"; + this.command.OutputType = JobOutputType.StandardOutput; + + if (this.StandardOutput.IsPresent) { - this.command.OutputType = JobOutputType.StandardError; + numSpecifiedOutputTypes++; } - else if (this.TaskSummary.IsPresent) + + if (this.DownloadTaskLogs.IsPresent) + { + this.command.OutputType = JobOutputType.TaskLogs; + selectedOutputType = "Task Logs"; + numSpecifiedOutputTypes++; + } + + if (this.TaskSummary.IsPresent) { this.command.OutputType = JobOutputType.TaskSummary; + selectedOutputType = "Task Summary"; + numSpecifiedOutputTypes++; } - else if (this.DownloadTaskLogs.IsPresent) + + if (this.StandardError.IsPresent) { - this.command.OutputType = JobOutputType.TaskLogs; + this.command.OutputType = JobOutputType.StandardError; + selectedOutputType = "Standard Error"; + numSpecifiedOutputTypes++; } - else + + if (numSpecifiedOutputTypes > 1) { - this.command.OutputType = JobOutputType.StandardOutput; + this.WriteWarning(String.Format("This cmdlet supports specifying only one job output type. Only {0} will be returned", selectedOutputType)); } try