moving API code
This commit is contained in:
@@ -16,4 +16,5 @@ assignError = MkUnknownError
|
|||||||
--
|
--
|
||||||
-- TODO: add error when internet connection is off
|
-- TODO: add error when internet connection is off
|
||||||
--
|
--
|
||||||
|
-- Left (MkUnknownError "Unexpected end-of-input, expecting JSON value")
|
||||||
-- MkSystemError 1 "/home/xecarlox/Desktop/p2p-rendering-computation/p2p-rendering-computation" "2024/11/09 21:08:06 Get \"http://0.0.0.0:8088/MAPPort?port=3333&domain_name=\": dial tcp 0.0.0.0:8088: connect: connection refused\n"
|
-- MkSystemError 1 "/home/xecarlox/Desktop/p2p-rendering-computation/p2p-rendering-computation" "2024/11/09 21:08:06 Get \"http://0.0.0.0:8088/MAPPort?port=3333&domain_name=\": dial tcp 0.0.0.0:8088: connect: connection refused\n"
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
module P2Prc ( runP2Prc )
|
module P2Prc ( runP2Prc ) where
|
||||||
where
|
|
||||||
|
|
||||||
|
import System.Process
|
||||||
import System.Process ( ProcessHandle, terminateProcess )
|
( ProcessHandle
|
||||||
|
, terminateProcess
|
||||||
|
)
|
||||||
|
|
||||||
import Control.Concurrent ( threadDelay )
|
import Control.Concurrent ( threadDelay )
|
||||||
|
|
||||||
|
import Data.Aeson ( FromJSON )
|
||||||
import Data.Aeson
|
|
||||||
|
|
||||||
|
|
||||||
import Environment ( cleanEnvironment )
|
import Environment ( cleanEnvironment )
|
||||||
@@ -23,6 +23,14 @@ import JSON
|
|||||||
)
|
)
|
||||||
|
|
||||||
import CLI
|
import CLI
|
||||||
|
( StdInput(..)
|
||||||
|
, CLIOpt(..)
|
||||||
|
, eitherErrDecode
|
||||||
|
, getP2PrcCmd
|
||||||
|
, eitherExecProcess
|
||||||
|
, eitherExecProcessParser
|
||||||
|
, spawnProcP2Prc
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
-- URGENT TASKS
|
-- URGENT TASKS
|
||||||
@@ -47,9 +55,6 @@ import CLI
|
|||||||
-- TODO: add use case examples (extra-source_files)
|
-- TODO: add use case examples (extra-source_files)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Module: API
|
|
||||||
|
|
||||||
runP2Prc :: IO ()
|
runP2Prc :: IO ()
|
||||||
runP2Prc = do
|
runP2Prc = do
|
||||||
|
|
||||||
@@ -135,6 +140,7 @@ runP2Prc = do
|
|||||||
(Left err) -> print err
|
(Left err) -> print err
|
||||||
|
|
||||||
|
|
||||||
|
-- Module: API
|
||||||
|
|
||||||
data P2prAPI = MkP2prAPI
|
data P2prAPI = MkP2prAPI
|
||||||
{ startServer :: IOEitherError ProcessHandle
|
{ startServer :: IOEitherError ProcessHandle
|
||||||
|
|||||||
Reference in New Issue
Block a user