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

sh with returnStdout does not work in external library

      Hello,

      I need to get sh return from an external library inside my pipeline.

      The code I execute in my shared library is the following : 

      def pomLocations = steps.sh(script: "find . -name pom.xml", returnStdout: true)
      

      Problem

      **After that I do 

      steps.sh 'echo "${TMPPackageLocation}"'
      

      But result is empty

      Note: `steps.sh(script: "find . -name pom.xml")` does work and result is not empty

      Thanks a lot in advance,

      JF 

       

          [JENKINS-58572] sh with returnStdout does not work in external library

          JO JO created issue -
          JO JO made changes -
          Description Original: Hello,

          I need to get sh return from an external library inside my pipeline.



          The code I execute in my shared library is the following : 

          ```def pomLocations = steps.sh(script: "find . -name pom.xml", returnStdout: true)```

          +*Problem*+

          **After that I do 

          ```steps.sh 'echo "${TMPPackageLocation}"'```

          But result is empty

          *Note:* `steps.sh(script: "find . -name pom.xml", returnStdout: true)` does work and result is not empty

          Thanks a lot in advance,

          JF 

           
          New: Hello,

          I need to get sh return from an external library inside my pipeline.

          The code I execute in my shared library is the following : 
          {code:java}
          def pomLocations = steps.sh(script: "find . -name pom.xml", returnStdout: true)
          {code}
          +*Problem*+

          **After that I do 
          {code:java}
          steps.sh 'echo "${TMPPackageLocation}"'
          {code}
          But result is empty

          *Note:* `steps.sh(script: "find . -name pom.xml", returnStdout: true)` does work and result is not empty

          Thanks a lot in advance,

          JF 

           
          JO JO made changes -
          Description Original: Hello,

          I need to get sh return from an external library inside my pipeline.

          The code I execute in my shared library is the following : 
          {code:java}
          def pomLocations = steps.sh(script: "find . -name pom.xml", returnStdout: true)
          {code}
          +*Problem*+

          **After that I do 
          {code:java}
          steps.sh 'echo "${TMPPackageLocation}"'
          {code}
          But result is empty

          *Note:* `steps.sh(script: "find . -name pom.xml", returnStdout: true)` does work and result is not empty

          Thanks a lot in advance,

          JF 

           
          New: Hello,

          I need to get sh return from an external library inside my pipeline.

          The code I execute in my shared library is the following : 
          {code:java}
          def pomLocations = steps.sh(script: "find . -name pom.xml", returnStdout: true)
          {code}
          +*Problem*+

          **After that I do 
          {code:java}
          steps.sh 'echo "${TMPPackageLocation}"'
          {code}
          But result is empty

          *Note:* `steps.sh(script: "find . -name pom.xml")` does work and result is not empty

          Thanks a lot in advance,

          JF 

           

          JO JO added a comment -

          JO JO added a comment - May be linked to  https://issues.jenkins-ci.org/browse/JENKINS-56384?page=com.atlassian.streams.streams-jira-plugin%3Aactivity-stream-issue-tab

            gbois Gregory Boissinot
            jojofreeeeeee JO JO
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: