diff --git a/CHANGELOG.md b/CHANGELOG.md
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,9 @@
 # Revision history for file-io
 
+## 0.2.0 -- 2025-01-30
+
+* Add ability to use `cloexec` in `openTempFile'` wrt [#44](https://github.com/haskell/file-io/issues/44)
+
 ## 0.1.6 -- 2025-01-30
 
 * Fix long path support on windows wrt [#39](https://github.com/haskell/file-io/issues/39)
diff --git a/System/File/OsPath/Internal.hs b/System/File/OsPath/Internal.hs
--- a/System/File/OsPath/Internal.hs
+++ b/System/File/OsPath/Internal.hs
@@ -160,14 +160,14 @@
                            -- be truncated to 3 chars, e.g. \"foobar.ext\" will be
                            -- \"fooXXX.ext\".
              -> IO (OsPath, Handle)
-openTempFile tmp_dir template = openTempFile' "openTempFile" tmp_dir template False 0o600
+openTempFile tmp_dir template = openTempFile' "openTempFile" tmp_dir template False 0o600 False
 
 -- | Like 'openTempFile', but opens the file in binary mode. See 'openBinaryFile' for more comments.
 --
 -- @since 0.1.3
 openBinaryTempFile :: OsPath -> OsString -> IO (OsPath, Handle)
 openBinaryTempFile tmp_dir template
-    = openTempFile' "openBinaryTempFile" tmp_dir template True 0o600
+    = openTempFile' "openBinaryTempFile" tmp_dir template True 0o600 False
 
 -- | Like 'openTempFile', but uses the default file permissions
 --
@@ -175,7 +175,7 @@
 openTempFileWithDefaultPermissions :: OsPath -> OsString
                                    -> IO (OsPath, Handle)
 openTempFileWithDefaultPermissions tmp_dir template
-    = openTempFile' "openTempFileWithDefaultPermissions" tmp_dir template False 0o666
+    = openTempFile' "openTempFileWithDefaultPermissions" tmp_dir template False 0o666 False
 
 -- | Like 'openBinaryTempFile', but uses the default file permissions
 --
@@ -183,7 +183,7 @@
 openBinaryTempFileWithDefaultPermissions :: OsPath -> OsString
                                          -> IO (OsPath, Handle)
 openBinaryTempFileWithDefaultPermissions tmp_dir template
-    = openTempFile' "openBinaryTempFileWithDefaultPermissions" tmp_dir template True 0o666
+    = openTempFile' "openBinaryTempFileWithDefaultPermissions" tmp_dir template True 0o666 False
 
 -- ---------------------------------------------------------------------------
 -- Internals
@@ -232,13 +232,13 @@
 augmentError str osfp = flip catchException (ioError . addFilePathToIOError str osfp)
 
 
-openTempFile' :: String -> OsPath -> OsString -> Bool -> CMode
+openTempFile' :: String -> OsPath -> OsString -> Bool -> CMode -> Bool
               -> IO (OsPath, Handle)
-openTempFile' loc (OsString tmp_dir) template@(OsString tmpl) binary mode
+openTempFile' loc (OsString tmp_dir) template@(OsString tmpl) binary mode cloExec
     | any_ (== OSP.pathSeparator) template
     = throwIO $ userError $ "openTempFile': Template string must not contain path separator characters: " ++ P.lenientDecode tmpl
     | otherwise = do
-        (fp, hdl) <- P.findTempName (prefix, suffix) loc tmp_dir mode
+        (fp, hdl) <- P.findTempName (prefix, suffix) loc tmp_dir mode cloExec
         when binary $ hSetBinaryMode hdl True
         pure (OsString fp, hdl)
   where
diff --git a/file-io.cabal b/file-io.cabal
--- a/file-io.cabal
+++ b/file-io.cabal
@@ -1,6 +1,6 @@
 cabal-version:      2.4
 name:               file-io
-version:            0.1.6
+version:            0.2.0
 synopsis:           Basic file IO operations via 'OsPath'
 description:        Basic file IO operations like Prelude, but for 'OsPath'.
 homepage:           https://github.com/hasufell/file-io
diff --git a/posix/System/File/Platform.hs b/posix/System/File/Platform.hs
--- a/posix/System/File/Platform.hs
+++ b/posix/System/File/Platform.hs
@@ -84,8 +84,9 @@
              -> String
              -> PosixPath
              -> CMode
+             -> Bool
              -> IO (PosixPath, Handle)
-findTempName (prefix, suffix) loc tmp_dir mode = go
+findTempName (prefix, suffix) loc tmp_dir mode cloExec = go
  where
   go = do
     rs <- rand_string
@@ -103,7 +104,7 @@
     else fmap (filepath,) $ fdToHandle_ ReadWriteMode filepath fd
 
   openTempFile_ :: PosixPath -> CMode -> IO Fd
-  openTempFile_ fp cmode = openFd fp ReadWrite defaultFileFlags' { creat = Just cmode, nonBlock = True, noctty = True, exclusive = True }
+  openTempFile_ fp cmode = openFd fp ReadWrite defaultFileFlags' { creat = Just cmode, nonBlock = True, noctty = True, exclusive = True, cloexec = cloExec }
 
 tempCounter :: IORef Int
 tempCounter = unsafePerformIO $ newIORef 0
diff --git a/windows/System/File/Platform.hsc b/windows/System/File/Platform.hsc
--- a/windows/System/File/Platform.hsc
+++ b/windows/System/File/Platform.hsc
@@ -174,8 +174,9 @@
              -> String
              -> WindowsPath
              -> CMode
+             -> Bool
              -> IO (WindowsPath, Handle)
-findTempName (prefix, suffix) loc tmp_dir mode = go
+findTempName (prefix, suffix) loc tmp_dir mode _cloExec = go
  where
   go = do
     let label = if prefix == mempty then fromJust (encodeUtf "ghc") else prefix
