Created
April 8, 2020 08:34
-
-
Save ThabetAmer/d2dfa76491ae53b706ab14dd6e41a3f0 to your computer and use it in GitHub Desktop.
Runs shell command and prints back stdout and stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env groovy | |
/* | |
* Runs shell command and prints back stdout and stderr | |
*/ | |
command='ls -al' | |
println new ProcessBuilder('sh','-c',command).redirectErrorStream(true).start().text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment