diff --git a/aws-runtime/aws-config/native/src/aws/sdk/kotlin/runtime/auth/credentials/executeCommandNative.kt b/aws-runtime/aws-config/native/src/aws/sdk/kotlin/runtime/auth/credentials/executeCommandNative.kt index 803781ec71d..14a8fa1e528 100644 --- a/aws-runtime/aws-config/native/src/aws/sdk/kotlin/runtime/auth/credentials/executeCommandNative.kt +++ b/aws-runtime/aws-config/native/src/aws/sdk/kotlin/runtime/auth/credentials/executeCommandNative.kt @@ -48,8 +48,8 @@ internal actual suspend fun executeCommand( } val shell = when (platformProvider.osInfo().family) { - OsFamily.Windows -> "cmd.exe" - else -> "sh" + OsFamily.Windows -> "C:\\\\Windows\\\\System32\\\\cmd.exe" + else -> "/bin/sh" } val shellArg = when (platformProvider.osInfo().family) { @@ -57,8 +57,10 @@ internal actual suspend fun executeCommand( else -> "-c" } - val argv = memScoped { (arrayOf(shell, shellArg, command).map { it.cstr.ptr } + null).toCValues() } - execvp(shell, argv) + memScoped { + val argv = (arrayOf(shell, shellArg, command).map { it.cstr.ptr } + null).toCValues() + execvp(shell, argv) + } _exit(127) // If exec fails }