@@ -74,7 +74,7 @@ import System.Environment (getArgs, getProgName)
74
74
import System.Exit
75
75
import System.FileLock (lockFile , tryLockFile , unlockFile , SharedExclusive (Exclusive ), FileLock )
76
76
import System.FilePath (dropTrailingPathSeparator )
77
- import System.IO (hIsTerminalDevice , stderr , stdin , stdout , hSetBuffering , BufferMode (.. ))
77
+ import System.IO (hIsTerminalDevice , stderr , stdin , stdout , hSetBuffering , BufferMode (.. ), hPutStrLn )
78
78
import System.Process.Read
79
79
80
80
#if WINDOWS
@@ -325,7 +325,7 @@ main = withInterpreterArgs stackProgName $ \args isInterpreter -> do
325
325
case eGlobalRun of
326
326
Left (exitCode :: ExitCode ) -> do
327
327
when isInterpreter $
328
- putStrLn $ concat
328
+ hPutStrLn stderr $ concat
329
329
[ " \n If you are trying to use "
330
330
, stackProgName
331
331
, " as a script interpreter, a\n '-- "
@@ -334,7 +334,7 @@ main = withInterpreterArgs stackProgName $ \args isInterpreter -> do
334
334
, " \n See https://github.com/commercialhaskell/stack/wiki/Script-interpreter" ]
335
335
throwIO exitCode
336
336
Right (global,run) -> do
337
- when (globalLogLevel global == LevelDebug ) $ putStrLn versionString'
337
+ when (globalLogLevel global == LevelDebug ) $ hPutStrLn stderr versionString'
338
338
run global `catch` \ e -> do
339
339
-- This special handler stops "stack: " from being printed before the
340
340
-- exception
@@ -585,12 +585,12 @@ withUserFileLock dir act = do
585
585
case fstTry of
586
586
Just lk -> EL. finally (act lk) (liftIO $ unlockFile lk)
587
587
Nothing ->
588
- do liftIO $ putStrLn $ " Failed to grab lock (" ++ show pth++
588
+ do liftIO $ hPutStrLn stderr $ " Failed to grab lock (" ++ show pth++
589
589
" ); other stack instance running. Waiting..."
590
590
EL. bracket (liftIO $ lockFile (toFilePath pth) Exclusive )
591
591
(liftIO . unlockFile)
592
592
(\ lk -> do
593
- liftIO $ putStrLn " Lock acquired, proceeding."
593
+ liftIO $ hPutStrLn stderr " Lock acquired, proceeding."
594
594
act lk))
595
595
596
596
withConfigAndLock :: GlobalOpts
0 commit comments