Why is SBT throwing error when running external process

Viewed 302

I'm creating a task in SBT that will upload some scripts to S3. I'm uploading to S3 using SBT external process with aws cli s"aws s3 cp ./someDir $uploadPath --recursive" ! log. It throws error

java.io.IOException: Cannot run program "aws": CreateProcess error=2, The system cannot find the file specified

This happens only on Windows. It works fine when I run the same project/task in Ubuntu build system. AWS cli is installed on Windows machine and PATH is set correctly.

Its not clear to me what is missing.

2 Answers

Another possible workaround is to run the command inside a shell (and you must know your shells for all "problematic" environments)

  val shell: Seq[String] = if (sys.props("os.name").contains("Windows")) Seq("cmd", "/c") else Seq("bash", "-c")
  val command: Seq[String] = shell :+ "<your command here>"
  command .!
Related