Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-65529

option to trim stdout on sh / bat

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.

            Unassigned Unassigned
            bgdnlp Bogdan Lp
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: