Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
GHC
GHC
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,319
    • Issues 4,319
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 360
    • Merge Requests 360
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
  • Security & Compliance
    • Security & Compliance
    • Dependency List
    • License Compliance
  • Operations
    • Operations
    • Incidents
    • Environments
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
  • Glasgow Haskell Compiler
  • GHCGHC
  • Issues
  • #2199

Closed
Open
Opened Apr 06, 2008 by guest@trac-guest

th32SnapEnumProcesses in System.Win32.Process prints debugging information to stdout

TSIA, pretty much. I suspect that when the author was developing this function he put in some putStrLn calls for his own use and simply forgot to remove them. For my application I just took the code out of the library and ripped out the offending statements, but I don't think they're really supposed to be there and ought to be either removed or #ifdef'd out somehow. Here's my cleaned up version (I also removed some extraneous parenthesis, FWIW).

th32SnapEnumProcesses :: Th32SnapHandle -> IO [ProcessEntry32]
th32SnapEnumProcesses h = allocaBytes 556 $ \pe -> do
    pokeByteOff pe 0 (556 :: DWORD)
    ok <- c_Process32First h pe
    readAndNext ok pe []
    where
        errStr = "th32SnapEnumProcesses: Process32First/Process32Next"
        readAndNext ok pe res
            | not ok    = do
                err <- getLastError
                if err == 18
                    then return $ reverse res
                    else failWith errStr err
            | otherwise = do
                entry <- peekProcessEntry32 pe
                ok' <- c_Process32Next h pe
                readAndNext ok' pe (entry:res)
Edited Mar 09, 2019 by Ian Lynagh <igloo@earth.li>
Assignee
Assign to
6.8.3
Milestone
6.8.3
Assign milestone
Time tracking
None
Due date
None
Reference: ghc/ghc#2199