Skip to content

Commit 68c310e

Browse files
committed
return A directly, rather than Try[A] (PR comment)
1 parent e4cb57f commit 68c310e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

os/src/TempOps.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package os
22

33
import java.nio.file.attribute.{FileAttribute, PosixFilePermissions}
4-
import scala.util.{Using, Try}
4+
import scala.util.Using
55

66
/**
77
* Create temporary files and directories. [[withTempFile]] and [[withTempDir]]
@@ -92,8 +92,8 @@ object temp {
9292
* }
9393
* }}}
9494
*/
95-
def withTempFile[A](fun: Path => A): Try[A] =
96-
Using(os.temp(
95+
def withTempFile[A](fun: Path => A): A =
96+
Using.resource(os.temp(
9797
deleteOnExit = false // TempFile.close() deletes it, no need to register with JVM
9898
))(fun)
9999

@@ -108,8 +108,8 @@ object temp {
108108
* }
109109
* }}}
110110
*/
111-
def withTempDir[A](fun: Path => A): Try[A] =
112-
Using(os.temp.dir(
111+
def withTempDir[A](fun: Path => A): A =
112+
Using.resource(os.temp.dir(
113113
deleteOnExit = false // TempFile.close() deletes it, no need to register with JVM
114114
))(fun)
115115

0 commit comments

Comments
 (0)