Fix exit-status: save exit code in ALL 3 try_wait() paths (not just timeout)
This commit is contained in:
BIN
data/auth.sqlite
BIN
data/auth.sqlite
Binary file not shown.
@@ -1629,8 +1629,10 @@ impl ChannelManager {
|
||||
if let Some(exec_process) = &mut channel.exec_process {
|
||||
match exec_process.child.try_wait() {
|
||||
Ok(Some(status)) => {
|
||||
info!("Child exited after max iterations (status: {:?})", status);
|
||||
let exit_code = status.code().unwrap_or(-1) as u32;
|
||||
info!("Child exited after max iterations (exit_status: {}, status: {:?})", exit_code, status);
|
||||
child_exited = true;
|
||||
channel.exit_status = Some(exit_code);
|
||||
|
||||
// 读取剩余stdout
|
||||
if let Some(stdout) = &mut exec_process.stdout {
|
||||
@@ -1804,8 +1806,10 @@ impl ChannelManager {
|
||||
// ⭐⭐⭐⭐⭐ 立即检查child是否exited
|
||||
match exec_process.child.try_wait() {
|
||||
Ok(Some(status)) => {
|
||||
info!("⭐⭐⭐⭐⭐ Child exited after stdout/stderr EOF (status: {:?})", status);
|
||||
let exit_code = status.code().unwrap_or(-1) as u32;
|
||||
info!("⭐⭐⭐⭐⭐ Child exited after stdout/stderr EOF (exit_status: {}, status: {:?})", exit_code, status);
|
||||
child_exited = true;
|
||||
channel.exit_status = Some(exit_code);
|
||||
|
||||
// ⭐⭐⭐⭐⭐ 关键:立即返回child_exited标志
|
||||
// server.rs会发送SSH_MSG_CHANNEL_EOF + CLOSE
|
||||
|
||||
Reference in New Issue
Block a user