Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
tweak start_node_without_binary api
  • Loading branch information
liamaharon committed Aug 8, 2023
commit d54f2fee7d6846777bf7350420648f69fde3dd9b
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test-utils/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ tokio = { version = "1.22.0", features = ["full"] }
node-primitives = { path = "../../bin/node/primitives" }
node-template = { path = "../../bin/node-template/node" }
sc-cli = { path = "../../client/cli" }
sc-service = { path = "../../client/service" }
futures = "0.3.28"
15 changes: 3 additions & 12 deletions test-utils/cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,26 +51,17 @@ use tokio::io::{AsyncBufReadExt, AsyncRead};
/// common::start_node_without_binary();
/// });
/// ```
pub fn start_node_without_binary() {
pub fn start_node_without_binary() -> Result<(), sc_service::error::Error> {
use sc_cli::SubstrateCli;

let cli = node_template::cli::Cli::from_iter(vec![
"node-template",
"node-template", // first arg is ignored, this could be anything.
"--dev",
"--tmp",
"--rpc-port=45789",
]);
let runner = cli.create_runner(&cli.run).unwrap();
match runner.run_node_until_exit(|config| async move {
node_template::service::new_full(config).map_err(sc_cli::Error::Service)
}) {
Ok(_) => {
println!("Node process exited successfully.");
},
Err(e) => {
println!("Node process exited with error: {:?}", e);
},
};
runner.run_node_until_exit(|config| async move { node_template::service::new_full(config) })
}

/// Starts a new Substrate node in development mode with a temporary chain.
Expand Down