mirror of
https://seed.radicle.dev/rad:z3qg5TKmN83afz2fj9z3fQjU8vaYE.git
synced 2026-11-21 10:30:49 +08:00
refactor: move request reading into a function
Signed-off-by: Lars Wirzenius <liw@liw.fi>
This commit is contained in:
+8
-2
@@ -58,8 +58,7 @@ fn fallible_main() -> Result<(), NativeError> {
|
||||
let profile = Profile::load().map_err(NativeError::LoadProfile)?;
|
||||
let storage = profile.storage.path();
|
||||
|
||||
let req = Request::from_reader(std::io::stdin()).map_err(NativeError::ReadRequest)?;
|
||||
debug!("request: {:#?}", req);
|
||||
let req = read_request()?;
|
||||
|
||||
if let Request::Trigger { repo, commit } = req {
|
||||
info!("Request to trigger CI on {}, {}", repo, commit);
|
||||
@@ -90,6 +89,13 @@ fn mkdir_run(config: &Config) -> Result<(Uuid, PathBuf), NativeError> {
|
||||
Ok((run_id, run_dir))
|
||||
}
|
||||
|
||||
/// Read a request from stdin.
|
||||
fn read_request() -> Result<Request, NativeError> {
|
||||
let req = Request::from_reader(std::io::stdin()).map_err(NativeError::ReadRequest)?;
|
||||
debug!("request: {:#?}", req);
|
||||
Ok(req)
|
||||
}
|
||||
|
||||
/// Perform the CI run.
|
||||
fn run(
|
||||
run_id: Uuid,
|
||||
|
||||
Reference in New Issue
Block a user