Commit affb0e5c authored by Valentin Reis's avatar Valentin Reis

Correcting file output.

parent 9d854fec
Pipeline #4655 passed with stage
in 27 seconds
...@@ -19,7 +19,8 @@ import System.Console.ANSI ...@@ -19,7 +19,8 @@ import System.Console.ANSI
import System.Console.ANSI.Types (Color) import System.Console.ANSI.Types (Color)
import System.Posix.Signals import System.Posix.Signals
import System.Process hiding (shell) import System.Process hiding (shell)
import Data.Text hiding (empty) import Data.Text as Text hiding (empty)
import Data.Text.IO as Text
data StackArgs = StackArgs data StackArgs = StackArgs
{ dargs :: [Text] --"Daemon arguments. Properly quote this." { dargs :: [Text] --"Daemon arguments. Properly quote this."
...@@ -112,7 +113,21 @@ prepareDaemonShell dargs daemon_out daemon_err nrm_log = do ...@@ -112,7 +113,21 @@ prepareDaemonShell dargs daemon_out daemon_err nrm_log = do
False -> die ("Clean config failed with exit code " <> repr n) False -> die ("Clean config failed with exit code " <> repr n)
printInfo $ format ("Running the daemon, main log at "%fp%", stdout at "%fp%", stderr at "%fp%"\n") nrm_log daemon_out daemon_err printInfo $ format ("Running the daemon, main log at "%fp%", stdout at "%fp%", stderr at "%fp%"\n") nrm_log daemon_out daemon_err
export "ARGO_NODEOS_CONFIG" (format fp confPath') export "ARGO_NODEOS_CONFIG" (format fp confPath')
return $ sh $ view $ inprocWithErr "daemon" (dargs ++ ["--nrm_log", Data.Text.pack $ (encodeString nrm_log)]) empty return $ twoWayPrint daemon_out daemon_err $ inprocWithErr "daemon"
(dargs ++ ["--nrm_log", Text.pack $ encodeString nrm_log])
empty
--twoWayPrint l
--case l of
-- Left out -> output daemon_out $ return out
-- Right err -> output daemon_err $ return err
twoWayPrint :: FilePath -> FilePath -> Shell (Either Line Line) -> IO ()
twoWayPrint outPath errPath s = sh $ do
handleOut <- using (writeonly outPath)
handleErr <- using (writeonly errPath)
s >>= \case
Left out -> liftIO $ Text.hPutStrLn handleOut (lineToText out)
Right err -> liftIO $ Text.hPutStrLn handleOut (lineToText err)
cmdShell :: FilePath -> Text -> FilePath -> FilePath -> Shell () cmdShell :: FilePath -> Text -> FilePath -> FilePath -> Shell ()
cmdShell manifest app cmd_out cmd_err = cmdShell manifest app cmd_out cmd_err =
......
...@@ -27,6 +27,10 @@ in rec ...@@ -27,6 +27,10 @@ in rec
}; };
dev-test = pkgs.stdenv.mkDerivation rec { dev-test = pkgs.stdenv.mkDerivation rec {
shellHook = ''
source completions/bash/argotk.sh
echo "Installed bash completions."
'';
name = "env"; name = "env";
env = pkgs.buildEnv { name = name; paths = buildInputs; }; env = pkgs.buildEnv { name = name; paths = buildInputs; };
buildInputs = [ buildInputs = [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment