option to trim stdout on sh / bat

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      Would it be possible to add an option like "trimOutput" to apply trim() to returnStdout without having to wrap the `sh` / `bat` steps in `script{}`?

       

      Edit:

      To clarify what I mean
      currently
      script {
           date = sh(
               script: "date +%Y%m%d",
               returnStdout: true).trim()
      }

      proposed:
      date = sh script: "date +%Y%m%d",
                returnStdout: true,
                trimOutput: true

       

      It's a simple thing and I assume quite common, but it would make pipelines more readable and it would be easier to figure out for people new to Jenkins if the option was right there in the docs, instead of having to hunt for it on StackOverflow.

            Assignee:
            Unassigned
            Reporter:
            Bogdan Lp
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: