File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
cardano-testnet/src/Testnet Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -127,6 +127,7 @@ startNode tp node ipv4 port _testnetMagic nodeCmd = GHC.withFrozenCallStack $ do
127
127
128
128
let nodeStdoutFile = logDir </> node </> " stdout.log"
129
129
nodeStderrFile = logDir </> node </> " stderr.log"
130
+ nodePidFile = logDir </> node </> " node.pid"
130
131
socketRelPath = socketDir </> node </> " sock"
131
132
sprocket = Sprocket tempBaseAbsPath socketRelPath
132
133
@@ -167,9 +168,12 @@ startNode tp node ipv4 port _testnetMagic nodeCmd = GHC.withFrozenCallStack $ do
167
168
-- We force the evaluation of initiateProcess so we can be sure that
168
169
-- the process has started. This allows us to read stderr in order
169
170
-- to fail early on errors generated from the cardano-node binary.
170
- _ <- liftIO (IO. getPid hProcess)
171
+ pid <- liftIO (IO. getPid hProcess)
171
172
>>= hoistMaybe (NodeExecutableError $ " startNode:" <+> pretty node <+> " 's process did not start." )
172
173
174
+ -- We then log the pid in the temp dir structure.
175
+ liftIO $ IO. writeFile nodePidFile $ show pid
176
+
173
177
-- Wait for socket to be created
174
178
eSprocketError <-
175
179
H. evalIO $
Original file line number Diff line number Diff line change @@ -124,7 +124,8 @@ cardanoTestnetDefault testnetOptions genesisOptions conf = do
124
124
-- > │ └── README.md
125
125
-- > ├── logs
126
126
-- > │ ├── node{1,2,3}
127
- -- > │ │ └── {stderr,stdout}.log
127
+ -- > │ │ ├── node.pid
128
+ -- > | | └── {stderr,stdout}.log
128
129
-- > │ ├── ledger-epoch-state-diffs.log
129
130
-- > │ ├── ledger-epoch-state.log
130
131
-- > │ ├── node-20241010121635.log
@@ -305,7 +306,6 @@ cardanoTestnet
305
306
<> spoNodeCliArgs
306
307
<> maybe [] extraCliArgs nodeOptions
307
308
pure $ eRuntime <&> \ rt -> rt{poolKeys= mKeys}
308
- -- TODO log the node's pid in a file. This is useful for killing the node later.
309
309
310
310
let (failedNodes, testnetNodes') = partitionEithers eTestnetNodes
311
311
unless (null failedNodes) $ do
You can’t perform that action at this time.
0 commit comments