MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / wait_on_process

Function wait_on_process

supervisor/src/process.rs:323–343  ·  view source on GitHub ↗
(
    mut process: Child,
    kill_rx: oneshot::Receiver<()>,
)

Source from the content-addressed store, hash-verified

321}
322
323async fn wait_on_process(
324 mut process: Child,
325 kill_rx: oneshot::Receiver<()>,
326) -> (bool, Result<ExitStatus>) {
327 let (killed, result) = tokio::select! {
328 _ = kill_rx => {
329 info!("Killing process");
330 if let Err(err) = process.kill().await {
331 error!("Failed to kill process: {err:?}");
332 }
333 (true, process.wait().await)
334 }
335 result = process.wait() => {
336 (false, result)
337 }
338 };
339 if killed {
340 info!("Killed");
341 }
342 (killed, result.map_err(Into::into))
343}
344
345async fn redirect(mut input: impl AsyncRead + Unpin, to: String) {
346 async fn consume(input: &mut (impl AsyncRead + Unpin)) -> Result<()> {

Callers 1

startMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected