1

I have tried Karate framework feature karate.fork to execute SCP command but it throws command error:

[scp.exe, -r, -i, C:\Users\pcmoh.ssh\id_rsa, user@server:/data/volume1/, C:\Users\pcmoh\karatetestjavascript\test\features\api\output] - Cannot run program "scp.exe": CreateProcess error=2, The system cannot find the file specified.

But SCP command is working fine in command prompt and in powershell window separately.

I could not resolve this issue.

Operating System: Windows 10

Code snippet - ISSUE-1

* def command =
            """
                function(line) {
                var proc = karate.fork({redirectErrorStream: false, useShell: true, line: line });
                proc.waitSync();
                karate.set('sysOut', proc.sysOut);
                karate.set('sysErr', proc.sysErr);
                karate.set('exitCode', proc.exitCode);
              }
            """
       * command('scp -r -i C:\\Users\\pcmoh\\.ssh\\id_rsa user@<server>:/data/volume1/ C:\\Users\\pcmoh\\karatetestjavascript\\test\\features\\api\\output')
       * match sysOut contains 'volume1'
       * assert exitCode == 0
James Z
  • 12,209
  • 10
  • 24
  • 44
  • sorry I can't help. maybe you can write a java program that does the scp and connect it - you already know how to do that | karate is an open source project, it needs people to step in and fix problems especially the windows edge cases – Peter Thomas Dec 01 '20 at 18:44

0 Answers0