@@ -14,58 +14,12 @@ See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
-}
16
16
17
- {-| This module exports the functions needed to create the instance of PosixIO
18
- for IO. The actual instance appears in "Plush.Run.Posix". This module is
19
- mostly to just remove clutter from that module.
17
+ {-# Language TypeFamilies #-}
18
+ {-# OPTIONS_GHC -fno-warn-orphans #-}
20
19
21
- Note that many of these functions are just re-exports from "System.Posix".
22
- -}
23
-
24
-
25
- module Plush.Run.Posix.IO (
26
- P. createDirectory ,
27
- P. removeDirectory ,
28
- getDirectoryContents ,
29
- P. getWorkingDirectory ,
30
- P. changeWorkingDirectory ,
31
-
32
- getInitialEnvironment ,
33
-
34
- P. getFileStatus ,
35
- P. getSymbolicLinkStatus ,
36
- isExecutable ,
37
-
38
- P. removeLink ,
39
- P. setFileTimes ,
40
- P. touchFile ,
41
-
42
- P. openFd ,
43
- P. createFile ,
44
- P. closeFd ,
45
-
46
- dupTo ,
47
- PM. dupFdCloseOnExec ,
48
- setCloseOnExec ,
49
-
50
- readAll ,
51
- write ,
52
-
53
- getUserHomeDirectoryForName ,
54
- realAndEffectiveIDsMatch ,
55
- getProcessID ,
56
-
57
- execProcess ,
58
- captureStdout ,
59
- pipeline ,
60
- contentFd ,
20
+ {-| This module exports the instance of PosixIO for IO. -}
61
21
62
- P. FileStatus ,
63
- P. accessTime ,
64
- P. modificationTime ,
65
- P. isRegularFile ,
66
- P. isDirectory ,
67
- P. isSymbolicLink ,
68
- ) where
22
+ module Plush.Run.Posix.IO () where
69
23
70
24
import Control.Applicative ((<$>) , (<*>) )
71
25
import Control.Concurrent (forkIO )
@@ -85,6 +39,52 @@ import qualified System.IO.Error as IO
85
39
import qualified System.Posix as P
86
40
import qualified System.Posix.Missing as PM
87
41
42
+ import qualified Plush.Run.Posix as PL
43
+
44
+ instance PL. PosixLike IO where
45
+ createDirectory = P. createDirectory
46
+ removeDirectory = P. removeDirectory
47
+ getDirectoryContents = getDirectoryContents
48
+ getWorkingDirectory = P. getWorkingDirectory
49
+ changeWorkingDirectory = P. changeWorkingDirectory
50
+
51
+ getInitialEnvironment = P. getEnvironment
52
+
53
+ type FileStatus IO = P. FileStatus
54
+ getFileStatus = P. getFileStatus
55
+ getSymbolicLinkStatus = P. getSymbolicLinkStatus
56
+ isExecutable = isExecutable
57
+
58
+ removeLink = P. removeLink
59
+ setFileTimes = P. setFileTimes
60
+ touchFile = P. touchFile
61
+
62
+ openFd = P. openFd
63
+ createFile = P. createFile
64
+ closeFd = P. closeFd
65
+
66
+ dupTo = dupTo
67
+ dupFdCloseOnExec = PM. dupFdCloseOnExec
68
+ setCloseOnExec = setCloseOnExec
69
+
70
+ readAll = readAll
71
+ write = write
72
+
73
+ getUserHomeDirectoryForName = getUserHomeDirectoryForName
74
+ realAndEffectiveIDsMatch = realAndEffectiveIDsMatch
75
+ getProcessID = getProcessID
76
+
77
+ execProcess = execProcess
78
+ captureStdout = captureStdout
79
+ pipeline = pipeline
80
+ contentFd = contentFd
81
+
82
+ instance PL. PosixLikeFileStatus P. FileStatus where
83
+ accessTime = P. accessTime
84
+ modificationTime = P. modificationTime
85
+ isRegularFile = P. isRegularFile
86
+ isDirectory = P. isDirectory
87
+ isSymbolicLink = P. isSymbolicLink
88
88
89
89
90
90
getDirectoryContents :: FilePath -> IO [FilePath ]
@@ -101,9 +101,6 @@ getDirectoryContents fp = do
101
101
else readUntilNull ds >>= return . (entry : )
102
102
103
103
104
- getInitialEnvironment :: IO [(String , String )]
105
- getInitialEnvironment = P. getEnvironment
106
-
107
104
isExecutable :: FilePath -> IO Bool
108
105
isExecutable path = P. fileAccess path False False True
109
106
0 commit comments