Skip to content

Commit 1eb8a93

Browse files
committed
ktlint
1 parent 78713d8 commit 1eb8a93

File tree

3 files changed

+50
-42
lines changed

3 files changed

+50
-42
lines changed

aws-runtime/aws-config/mingw/src/aws/sdk/kotlin/runtime/auth/credentials/executeCommandMingw.kt

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,18 +77,20 @@ internal actual suspend fun executeCommand(
7777
}
7878
val pi = alloc<PROCESS_INFORMATION>()
7979

80-
check(CreateProcessW(
81-
cmdExe, // lpApplicationName
82-
cmdLineBuf, // lpCommandLine
83-
null, // lpProcessAttributes
84-
null, // lpThreadAttributes
85-
TRUE, // bInheritHandles
86-
CREATE_NO_WINDOW.toUInt(), // dwCreationFlags
87-
null, // lpEnvironment
88-
null, // lpCurrentDirectory
89-
si.ptr, // lpStartupInfo
90-
pi.ptr, // lpProcessInformation
91-
) == 0) { "CreateProcessW failed (GetLastError=${GetLastError()})" }
80+
check(
81+
CreateProcessW(
82+
cmdExe, // lpApplicationName
83+
cmdLineBuf, // lpCommandLine
84+
null, // lpProcessAttributes
85+
null, // lpThreadAttributes
86+
TRUE, // bInheritHandles
87+
CREATE_NO_WINDOW.toUInt(), // dwCreationFlags
88+
null, // lpEnvironment
89+
null, // lpCurrentDirectory
90+
si.ptr, // lpStartupInfo
91+
pi.ptr, // lpProcessInformation
92+
) == 0,
93+
) { "CreateProcessW failed (GetLastError=${GetLastError()})" }
9294

9395
try {
9496
// 5) wait + timeout
@@ -149,9 +151,15 @@ internal actual suspend fun executeCommand(
149151
}
150152
val n = buf.usePinned {
151153
val ok = ReadFile(hIn, it.addressOf(0), toRead.toUInt(), bytesReadVar.ptr, null)
152-
if (ok == 0 || bytesReadVar.value == 0u) 0 else bytesReadVar.value.toInt()
154+
if (ok == 0 || bytesReadVar.value == 0u) {
155+
0
156+
} else {
157+
bytesReadVar.value.toInt()
158+
}
159+
}
160+
if (n <= 0) {
161+
break
153162
}
154-
if (n <= 0) break
155163
total += n
156164
sb.append(buf.decodeToString(0, n))
157165
}

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55
import aws.sdk.kotlin.gradle.dsl.configureLinting
6-
import aws.sdk.kotlin.gradle.kmp.configureIosSimulatorTasks
76
import aws.sdk.kotlin.gradle.dsl.configureMinorVersionStrategyRules
7+
import aws.sdk.kotlin.gradle.kmp.configureIosSimulatorTasks
88
import aws.sdk.kotlin.gradle.publishing.SonatypeCentralPortalPublishTask
99
import aws.sdk.kotlin.gradle.publishing.SonatypeCentralPortalWaitForPublicationTask
1010
import aws.sdk.kotlin.gradle.util.typedProp

services/polly/common/test/aws/sdk/kotlin/services/polly/PollyTest.kt

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,36 +22,36 @@ import kotlin.test.assertTrue
2222
import kotlin.time.Duration.Companion.seconds
2323

2424
class PollyPresignerTest {
25-
@Test
26-
fun itProducesExpectedUrlComponents() = runTest {
27-
val request = SynthesizeSpeechRequest {
28-
voiceId = VoiceId.Salli
29-
outputFormat = OutputFormat.Pcm
30-
text = "hello world"
31-
}
25+
@Test
26+
fun itProducesExpectedUrlComponents() = runTest {
27+
val request = SynthesizeSpeechRequest {
28+
voiceId = VoiceId.Salli
29+
outputFormat = OutputFormat.Pcm
30+
text = "hello world"
31+
}
3232

33-
val pollyClient = PollyClient {
34-
region = "us-east-2"
35-
credentialsProvider = StaticCredentialsProvider {
36-
accessKeyId = "AKID"
37-
secretAccessKey = "secret"
38-
}
39-
httpClient = NoHttpEngine
40-
}
33+
val pollyClient = PollyClient {
34+
region = "us-east-2"
35+
credentialsProvider = StaticCredentialsProvider {
36+
accessKeyId = "AKID"
37+
secretAccessKey = "secret"
38+
}
39+
httpClient = NoHttpEngine
40+
}
4141

42-
try {
43-
val presignedRequest = pollyClient.presignSynthesizeSpeech(request, 10.seconds)
42+
try {
43+
val presignedRequest = pollyClient.presignSynthesizeSpeech(request, 10.seconds)
4444

45-
assertEquals(HttpMethod.GET, presignedRequest.method)
46-
assertTrue("Host".equals(presignedRequest.headers.entries().single().key, ignoreCase = true))
47-
assertEquals("polly.us-east-2.amazonaws.com", presignedRequest.headers["Host"])
48-
assertEquals("/v1/speech", presignedRequest.url.path.toString())
49-
val expectedQueryParameters = setOf("OutputFormat", "Text", "VoiceId", "X-Amz-Algorithm", "X-Amz-Credential", "X-Amz-Date", "X-Amz-SignedHeaders", "X-Amz-Expires", "X-Amz-Signature")
50-
assertEquals(expectedQueryParameters, presignedRequest.url.parameters.encodedParameters.keys)
51-
} finally {
52-
pollyClient.close()
53-
}
54-
}
45+
assertEquals(HttpMethod.GET, presignedRequest.method)
46+
assertTrue("Host".equals(presignedRequest.headers.entries().single().key, ignoreCase = true))
47+
assertEquals("polly.us-east-2.amazonaws.com", presignedRequest.headers["Host"])
48+
assertEquals("/v1/speech", presignedRequest.url.path.toString())
49+
val expectedQueryParameters = setOf("OutputFormat", "Text", "VoiceId", "X-Amz-Algorithm", "X-Amz-Credential", "X-Amz-Date", "X-Amz-SignedHeaders", "X-Amz-Expires", "X-Amz-Signature")
50+
assertEquals(expectedQueryParameters, presignedRequest.url.parameters.encodedParameters.keys)
51+
} finally {
52+
pollyClient.close()
53+
}
54+
}
5555
}
5656

5757
object NoHttpEngine : HttpClientEngineBase("no-http") {

0 commit comments

Comments
 (0)