Skip to content

Commit 9140bd8

Browse files
author
Hamed Soleimani
committed
change FS operations to use BG context
1 parent ba1360e commit 9140bd8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plugins/core/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/FeatureDevSessionContext.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,19 +202,21 @@ class FeatureDevSessionContext(val project: Project, val maxProjectSizeBytes: Lo
202202
}
203203

204204
val zipFilePath = createTemporaryZipFileAsync { zipfs ->
205-
val isPosix = FileSystems.getDefault().supportedFileAttributeViews().contains("posix")
205+
val posixFileAttributeSubstr = "posix"
206+
val isPosix = FileSystems.getDefault().supportedFileAttributeViews().contains(posixFileAttributeSubstr)
206207
filesToIncludeFlow.collect { file ->
207208

208209
if (!file.isDirectory) {
209210
val externalFilePath = Path(file.path)
210211
val relativePath = Path(file.path).relativeTo(projectRootPath)
211212
val zipfsPath = zipfs.getPath("/$relativePath")
212-
runBlocking {
213+
withContext(getCoroutineBgContext()) {
213214
zipfsPath.createParentDirectories()
214215
try {
215216
Files.copy(externalFilePath, zipfsPath, StandardCopyOption.REPLACE_EXISTING)
216217
if (isPosix) {
217-
Files.setAttribute(zipfsPath, "zip:permissions", externalFilePath.getPosixFilePermissions())
218+
val zipPermissionAttributeName = "zip:permissions"
219+
Files.setAttribute(zipfsPath, zipPermissionAttributeName, externalFilePath.getPosixFilePermissions())
218220
}
219221
} catch (e: NoSuchFileException) {
220222
// Noop: Skip if file was deleted

0 commit comments

Comments
 (0)