Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

something wrong when running inside container #838

Open
vCassius opened this issue Nov 3, 2023 · 0 comments
Open

something wrong when running inside container #838

vCassius opened this issue Nov 3, 2023 · 0 comments

Comments

@vCassius
Copy link

vCassius commented Nov 3, 2023

Describe the bug
something wrong when running inside container

  • source 1:
    match crossterm::terminal::enable_raw_mode() {
        Ok(_) => {}
        Err(e) => {
            tracing::error!("failed to enable raw mode,err: {e}")
        }
    };
  • exception 1:
End of terminal size stream
thread 'tokio-runtime-worker' panicked at /Users/vincent/.cargo/registry/src/rsproxy.cn-8f6827c7555bfaf8/tokio-1.32.0/src/runtime/task/core.rs:381:22:
JoinHandle polled after completion
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  2023-11-03 09:24:10.662 ERROR v_kubernetes_action::pkg::salvo::router::pod: failed to enable raw mode,err: No such device or address (os error 6)
    at src/pkg/salvo/router/pod.rs:457
  • source 2:
#[cfg(unix)]
// Send the new terminal size to channel when it change
async fn handle_terminal_size(mut channel: Sender<TerminalSize>) -> anyhow::Result<()> {
    let (width, height) = match crossterm::terminal::size() {
        Ok((w, h)) => (w, h),
        Err(e) => {
            let err = format!("fail to cross term terminal size ,err: {e}");
            tracing::error!("fail to cross term terminal size ,err: {err}");
            return Err(anyhow!(err));
        }
    };
    match channel.send(TerminalSize { height, width }).await {
        Ok(_) => {}
        Err(e) => {
            let err = format!("fail to send terminal size to channel,err: {e}");
            tracing::error!(err);
            return Err(anyhow!(err));
        }
    };

    // create a stream to catch SIGWINCH signal
    let mut sig = match signal::unix::signal(signal::unix::SignalKind::window_change()) {
        Ok(s) => s,
        Err(e) => {
            let err = format!("fail to windows change err{e}");
            tracing::error!(err);
            return Err(anyhow!(err));
        }
    };
    loop {
        if (sig.recv().await).is_none() {
            return Ok(());
        }
        let (width, height) = match crossterm::terminal::size() {
            Ok((w, h)) => (w, h),
            Err(e) => {
                let err = format!("fail to cross term terminal size ,err: {e}");
                tracing::error!("fail to cross term terminal size ,err: {err}");
                return Err(anyhow!(err));
            }
        };
        match channel.send(TerminalSize { height, width }).await {
            Ok(_) => {}
            Err(e) => {
                let err = format!("fail to send terminal size to channel,err: {e}");
                tracing::error!(err);
                return Err(anyhow!(err));
            }
        };
    }
}
  • exception 2:
  2023-11-03 14:11:24.853 ERROR v_kubernetes_action::pkg::salvo::router::pod: fail to cross term terminal size ,err: fail to cross term terminal size ,err: Resource temporarily unavailable (os error 11)
    at src/pkg/salvo/router/pod.rs:655

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

OS
container: amd64/debian:12.1-slim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant