How to execute a command in a Jenkins 2.0 Pipeline job and then return the stdout
<p>Is there a better way to run a shell task in a Jenkins 2.0 pipeline and then return the <code>stdout</code> of the command.  The only way I can get this to work is to pipe the output of the command to a file and then read the file in to a variable.</p>

<pre class="lang-sh prettyprint-override"><code>sh('git config --get remote.origin.url &gt; GIT_URL')
def stdout = readFile('GIT_URL').trim()
</code></pre>

<p>This seems like a really bad way to return the output. I was hoping I could do something like:</p>

<pre class="lang-sh prettyprint-override"><code>def stdout = sh('git config --get remote.origin.url').stdout
</code></pre>

<p>or </p>

<pre class="lang-sh prettyprint-override"><code>def exitcode = sh('git config --get remote.origin.url').exitcode
</code></pre>

<p>Is this possible?</p>