add debug logging wrapper for withCreateProcess
This commit is contained in:
		
					parent
					
						
							
								b60b8ecc78
							
						
					
				
			
			
				commit
				
					
						c8ff3e082e
					
				
			
		
					 1 changed files with 8 additions and 2 deletions
				
			
		| 
						 | 
					@ -22,6 +22,7 @@ module Utility.Process (
 | 
				
			||||||
	checkSuccessProcess,
 | 
						checkSuccessProcess,
 | 
				
			||||||
	withNullHandle,
 | 
						withNullHandle,
 | 
				
			||||||
	createProcess,
 | 
						createProcess,
 | 
				
			||||||
 | 
						withCreateProcess,
 | 
				
			||||||
	waitForProcess,
 | 
						waitForProcess,
 | 
				
			||||||
	cleanupProcess,
 | 
						cleanupProcess,
 | 
				
			||||||
	startInteractiveProcess,
 | 
						startInteractiveProcess,
 | 
				
			||||||
| 
						 | 
					@ -33,8 +34,8 @@ module Utility.Process (
 | 
				
			||||||
) where
 | 
					) where
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import qualified Utility.Process.Shim
 | 
					import qualified Utility.Process.Shim
 | 
				
			||||||
import qualified Utility.Process.Shim as X hiding (CreateProcess(..), createProcess, runInteractiveProcess, readProcess, readProcessWithExitCode, system, rawSystem, runInteractiveCommand, runProcess, cleanupProcess)
 | 
					import qualified Utility.Process.Shim as X hiding (CreateProcess(..), createProcess, withCreateProcess, runInteractiveProcess, readProcess, readProcessWithExitCode, system, rawSystem, runInteractiveCommand, runProcess, cleanupProcess)
 | 
				
			||||||
import Utility.Process.Shim hiding (createProcess, readProcess, waitForProcess, cleanupProcess)
 | 
					import Utility.Process.Shim hiding (createProcess, withCreateProcess, readProcess, waitForProcess, cleanupProcess)
 | 
				
			||||||
import Utility.Misc
 | 
					import Utility.Misc
 | 
				
			||||||
import Utility.Exception
 | 
					import Utility.Exception
 | 
				
			||||||
import Utility.Monad
 | 
					import Utility.Monad
 | 
				
			||||||
| 
						 | 
					@ -177,6 +178,11 @@ createProcess p = do
 | 
				
			||||||
	debugProcess p
 | 
						debugProcess p
 | 
				
			||||||
	Utility.Process.Shim.createProcess p
 | 
						Utility.Process.Shim.createProcess p
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					-- | Wrapper around 'System.Process.withCreateProcess' that does debug logging.
 | 
				
			||||||
 | 
					withCreateProcess :: CreateProcess -> (Maybe Handle -> Maybe Handle -> Maybe Handle -> ProcessHandle -> IO a) -> IO a
 | 
				
			||||||
 | 
					withCreateProcess p action = bracket (createProcess p) cleanupProcess
 | 
				
			||||||
 | 
						(\(m_in, m_out, m_err, ph) -> action m_in m_out m_err ph)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
-- | Debugging trace for a CreateProcess.
 | 
					-- | Debugging trace for a CreateProcess.
 | 
				
			||||||
debugProcess :: CreateProcess -> IO ()
 | 
					debugProcess :: CreateProcess -> IO ()
 | 
				
			||||||
debugProcess p = debugM "Utility.Process" $ unwords
 | 
					debugProcess p = debugM "Utility.Process" $ unwords
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue