cleanup
This commit is contained in:
parent
e32dda07ca
commit
d91950ecba
1 changed files with 2 additions and 5 deletions
|
@ -11,11 +11,10 @@ module Utility.Lsof where
|
||||||
|
|
||||||
import Common
|
import Common
|
||||||
|
|
||||||
import System.Cmd.Utils
|
|
||||||
import System.Posix.Types
|
import System.Posix.Types
|
||||||
|
|
||||||
data LsofOpenMode = OpenReadWrite | OpenReadOnly | OpenWriteOnly | OpenUnknown
|
data LsofOpenMode = OpenReadWrite | OpenReadOnly | OpenWriteOnly | OpenUnknown
|
||||||
deriving (Show)
|
deriving (Show, Eq)
|
||||||
|
|
||||||
type CmdLine = String
|
type CmdLine = String
|
||||||
|
|
||||||
|
@ -46,7 +45,7 @@ parse s = bundle $ go [] $ lines s
|
||||||
bundle = concatMap (\(fs, p) -> map (\(f, m) -> (f, m, p)) fs)
|
bundle = concatMap (\(fs, p) -> map (\(f, m) -> (f, m, p)) fs)
|
||||||
|
|
||||||
go c [] = c
|
go c [] = c
|
||||||
go c (l@(t:r):ls)
|
go c ((t:r):ls)
|
||||||
| t == 'p' =
|
| t == 'p' =
|
||||||
let (fs, ls') = parsefiles [] ls
|
let (fs, ls') = parsefiles [] ls
|
||||||
in go ((fs, parseprocess r):c) ls'
|
in go ((fs, parseprocess r):c) ls'
|
||||||
|
@ -74,8 +73,6 @@ parse s = bundle $ go [] $ lines s
|
||||||
parsemode ('u':_) = OpenReadWrite
|
parsemode ('u':_) = OpenReadWrite
|
||||||
parsemode _ = OpenUnknown
|
parsemode _ = OpenUnknown
|
||||||
|
|
||||||
ls = lines s
|
|
||||||
|
|
||||||
splitnull = split "\0"
|
splitnull = split "\0"
|
||||||
|
|
||||||
parsefail = error $ "failed to parse lsof output: " ++ show s
|
parsefail = error $ "failed to parse lsof output: " ++ show s
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue