This repository has been archived by the owner on Dec 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(toolchain): allow hooking to existing game server process
- Loading branch information
1 parent
8e1c48b
commit 2ed757a
Showing
4 changed files
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
use std::collections::HashMap; | ||
|
||
use anyhow::*; | ||
use serde::{Deserialize, Serialize}; | ||
|
||
use crate::util::task; | ||
|
||
#[derive(Deserialize)] | ||
pub struct Input {} | ||
|
||
#[derive(Serialize)] | ||
pub struct Output { | ||
exit_code: Option<i32>, | ||
} | ||
|
||
pub struct Task; | ||
|
||
impl task::Task for Task { | ||
type Input = Input; | ||
type Output = Output; | ||
|
||
fn name() -> &'static str { | ||
"game_server.hook" | ||
} | ||
|
||
async fn run(task: task::TaskCtx, _input: Self::Input) -> Result<Self::Output> { | ||
let exit_code = crate::game_server::PROCESS_MANAGER | ||
.hook(task.clone()) | ||
.await?; | ||
Ok(Output { exit_code }) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
pub mod hook; | ||
pub mod start; | ||
pub mod stop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters