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

bat(returnStdout: true) step returns the whole command not just the stdout

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved (View Workflow)
    • Minor
    • Resolution: Not A Defect
    • durable-task-plugin

    Description

      On a `pipeline` or `multibranch pipeline` job 

      The bat(returnStdout: true) step returns the whole command not just the stdout

      i.e

      node('windows') {
      
          stage('Checkout'){
              git('http://github.com/test/test')
              stdout = bat(returnStdout: true, script: 'git rev-parse HEAD')
              println("stdout ################ " + stdout + " ####################")
         }
      
      }
      

      returns

       

      stdout  ################ 
      C:\hudson\workspace\test_UT_pipeline_statuses-J5YZJ3FX5VOUPIOVLCDBLV55WCESHMXOR3K32NSM442TR2P4MNEQ>git rev-parse HEAD 
      ff0f0401354a0faa6cf9c08fd513beddb85997ec
       ####################
      

      instead of just

      ff0f0401354a0faa6cf9c08fd513beddb85997ec
      

      as it is done by the sh(returnStdout: true) function

       

      Workaround will be to discard the first line of the returned string

      Attachments

        Activity

          fnaum Federico Naum created issue -
          jglick Jesse Glick made changes -
          Field Original Value New Value
          Component/s durable-task-plugin [ 18622 ]
          Component/s pipeline [ 21692 ]
          jglick Jesse Glick made changes -
          Resolution Not A Defect [ 7 ]
          Status Open [ 1 ] Resolved [ 5 ]

          People

            Unassigned Unassigned
            fnaum Federico Naum
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: