Reputation: 85
When we use karate.fork for CLI command and need some information from there to be stored in a variable and using it in the next step.
for EX - karate.fork('java -version')
We need to get only the version data alone.
Upvotes: 2
Views: 663
Reputation: 58058
Then karate.fork()
is the wrong choice - just use karate.exec()
instead. It does the same thing, but will block, and also return the console output:
* def output = karate.exec('java -version')
Please read this also for advanced examples: https://stackoverflow.com/a/62911366/143475
Upvotes: 2