2

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.

NagaRaj
  • 85
  • 7

1 Answers1

2

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

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248