summaryrefslogtreecommitdiffstats
path: root/src/Flameshot
diff options
context:
space:
mode:
Diffstat (limited to 'src/Flameshot')
-rw-r--r--src/Flameshot/Internal/Process.hs25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/Flameshot/Internal/Process.hs b/src/Flameshot/Internal/Process.hs
index a4dc963..c25ac39 100644
--- a/src/Flameshot/Internal/Process.hs
+++ b/src/Flameshot/Internal/Process.hs
@@ -3,12 +3,12 @@
{-# LANGUAGE MultiWayIf #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
-module Flameshot.Internal.Process (Callbacks(..),run,runAway,writeDaemon) where
+module Flameshot.Internal.Process (Callbacks(..),run,runAway) where
import Control.Concurrent (forkIO,threadDelay)
import Control.Concurrent.Async (race)
import Control.Exception
-import Control.Monad.Extended (untilM_,unless,void)
+import Control.Monad.Extended (untilM_,unless)
import Data.ByteString (ByteString)
import qualified Data.ByteString as BS
import Data.Text (Text)
@@ -18,11 +18,6 @@ import System.IO (BufferMode(LineBuffering),hSetBuffering)
import System.IO (Handle,hClose,hIsEOF)
import System.IO.Error (catchIOError,isDoesNotExistError)
import System.Process
-import System.Posix.Directory (changeWorkingDirectory)
-import System.Posix.Files (setFileCreationMask)
-import System.Posix.IO (closeFd,dupTo,openFd,stdError,stdInput,stdOutput)
-import System.Posix.IO (defaultFileFlags,OpenMode(WriteOnly))
-import System.Posix.Process (createSession,forkProcess,getProcessStatus)
import System.Posix.Process (getProcessGroupIDOf)
import System.Posix.Signals (Signal,signalProcessGroup,killProcess)
import System.Posix.Types (ProcessGroupID)
@@ -114,22 +109,6 @@ run path args cwd env input hTimeout Callbacks{..} =
, new_session = True
}
-
-writeDaemon :: FilePath -> [String] -> ByteString -> IO ()
-writeDaemon path args input = do
- pid <- forkProcess $ do
- _ <- setFileCreationMask 0o0027
- _ <- createSession
- changeWorkingDirectory "/"
- closeFd stdInput
- bracket (openFd "/dev/null" WriteOnly Nothing defaultFileFlags) closeFd
- $ \hnull -> mapM_ (dupTo hnull) [stdOutput, stdError]
- (Just hin, _, _, _) <-
- createProcess (proc path args) { std_in = CreatePipe }
- BS.hPut hin input
- hClose hin
- void (getProcessStatus True False pid)
-
runAway :: FilePath
-> [String]
-> Maybe FilePath