Skip to content

Commit e009889

Browse files
committed
Fix os.write.outputStream with perms for Scala 3
1 parent 36e00e0 commit e009889

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

os/src/ReadWriteOps.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ object write {
3131
if (createFolders) makeDir.all(target / RelPath.up, perms)
3232
if (perms != null && !exists(target)) {
3333
val permArray =
34-
if (perms == null) Array[FileAttribute[PosixFilePermission]]()
35-
else Array(PosixFilePermissions.asFileAttribute(perms.toSet()))
34+
if (perms == null) Seq[FileAttribute[PosixFilePermission]]()
35+
else Seq(PosixFilePermissions.asFileAttribute(perms.toSet()))
3636
java.nio.file.Files.createFile(target.toNIO, permArray: _*)
3737
}
3838

os/test/src/ReadingWritingTests.scala

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,19 @@ object ReadingWritingTests extends TestSuite {
121121
out.write('o')
122122
out.close()
123123

124+
os.read(wd / "New File.txt") ==> "Hello"
125+
}
126+
}
127+
test("outputStreamWithPerms") {
128+
test - prep { wd =>
129+
val out = os.write.outputStream(wd / "New File.txt", perms = os.PermSet(420))
130+
out.write('H')
131+
out.write('e')
132+
out.write('l')
133+
out.write('l')
134+
out.write('o')
135+
out.close()
136+
124137
os.read(wd / "New File.txt") ==> "Hello"
125138
}
126139
}

0 commit comments

Comments
 (0)