summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortv <tv@krebsco.de>2020-05-01 10:03:26 +0200
committertv <tv@krebsco.de>2020-05-01 10:06:03 +0200
commit156f4774ca62e84d5a936597cec1b2faf1edee20 (patch)
tree38beef9906bf2cd8077ea9a089a4b8ae525ae2e3
parent2f2acb0211f80a711eac7d188d979e0280c455d7 (diff)
Flameshot.Internal.Process: drop writeDaemon
-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