Function substrate_cli_test_utils::start_node_inline
source · pub fn start_node_inline(args: Vec<&str>) -> Result<(), Error>
Expand description
Similar to crate::start_node
spawns a node, but works in environments where the substrate
binary is not accessible with cargo_bin("substrate-node")
, and allows customising the args
passed in.
Helpful if you need a Substrate dev node running in the background of a project external to
substrate
.
The downside compared to using crate::start_node
is that this method is blocking rather than
returning a Child
. Therefore, you may want to call this method inside a new thread.
§Example
ⓘ
// Spawn a dev node.
let _ = std::thread::spawn(move || {
match common::start_node_inline(vec!["--dev", "--rpc-port=12345"]) {
Ok(_) => {}
Err(e) => {
panic!("Node exited with error: {}", e);
}
}
});