tunnel cli: add --parent-process-id option (#163935)

* tunnel cli: add --parent-process-id option

* Update cli/src/commands/args.rs

Co-authored-by: Connor Peet <connor@peet.io>

* Change parent process check interval to 2s

Co-authored-by: Connor Peet <connor@peet.io>
This commit is contained in:
Martin Aeschlimann
2022-10-18 20:52:10 +02:00
committed by GitHub
parent 5e170fc758
commit c6188602f4
5 changed files with 47 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
use crate::commands::tunnels::ShutdownSignal;
use crate::constants::{CONTROL_PORT, PROTOCOL_VERSION, VSCODE_CLI_VERSION};
use crate::log;
use crate::self_update::SelfUpdate;
@@ -23,7 +24,7 @@ use std::sync::Arc;
use std::time::Instant;
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt, BufReader};
use tokio::pin;
use tokio::sync::{mpsc, oneshot, Mutex};
use tokio::sync::{mpsc, Mutex};
use super::code_server::{
AnyCodeServer, CodeServerArgs, ServerBuilder, ServerParamsRaw, SocketCodeServer,
@@ -181,7 +182,7 @@ pub async fn serve(
launcher_paths: &LauncherPaths,
code_server_args: &CodeServerArgs,
platform: Platform,
shutdown_rx: oneshot::Receiver<()>,
shutdown_rx: mpsc::Receiver<ShutdownSignal>,
) -> Result<ServerTermination, AnyError> {
let mut port = tunnel.add_port_direct(CONTROL_PORT).await?;
print_listening(log, &tunnel.name);
@@ -194,8 +195,8 @@ pub async fn serve(
loop {
tokio::select! {
_ = &mut shutdown_rx => {
info!(log, "Received interrupt, shutting down...");
Some(r) = shutdown_rx.recv() => {
info!(log, "Shutting down: {}", r );
drop(signal_exit);
return Ok(ServerTermination {
respawn: false,