• Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Minor Minor
    • pipeline
    • None

      Usually when you execute some shell script and you need to reuse the output for another shell script or internal you need to do something like:

      sh('git rev-parse HEAD > GIT_COMMIT')
      git_commit=readFile('GIT_COMMIT')
      

      This is ok, but maybe we could provide something like:

      git_commit = sho('git rev-parse HEAD')
      

      sho = shell output
      which basically takes the output and put it in a var.

      Another option could be adding a parameter to sh that indicates that we want to capture the outout and return it back.

          [JENKINS-33173] Improve how to get output of sh execution

          Alex Soto created issue -
          Jesse Glick made changes -
          Link New: This issue duplicates JENKINS-26133 [ JENKINS-26133 ]
          Jesse Glick made changes -
          Resolution New: Duplicate [ 3 ]
          Status Original: Open [ 1 ] New: Resolved [ 5 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 169047 ] New: JNJira + In-Review [ 198522 ]
          Andrew Bayer made changes -
          Component/s New: pipeline-general [ 21692 ]
          Andrew Bayer made changes -
          Component/s Original: workflow-plugin [ 18820 ]

            jglick Jesse Glick
            asotobueno Alex Soto
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: