Skip to content

Commit bb50b6a

Browse files
pacmancoderCBenoit
authored andcommitted
fix(agent): hide console windows for exec sessions with IO redirection
1 parent f461a6d commit bb50b6a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

devolutions-session/src/dvc/process.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ use windows::Win32::Storage::FileSystem::{ReadFile, WriteFile};
66
use windows::Win32::System::IO::{GetOverlappedResult, OVERLAPPED};
77
use windows::Win32::System::Threading::{
88
CREATE_NEW_CONSOLE, CREATE_NEW_PROCESS_GROUP, CreateProcessW, INFINITE, NORMAL_PRIORITY_CLASS, PROCESS_INFORMATION,
9-
STARTF_USESTDHANDLES, STARTUPINFOW, WaitForMultipleObjects,
9+
STARTF_USESHOWWINDOW, STARTF_USESTDHANDLES, STARTUPINFOW, WaitForMultipleObjects,
1010
};
11-
use windows::Win32::UI::WindowsAndMessaging::WM_QUIT;
11+
use windows::Win32::UI::WindowsAndMessaging::{SW_HIDE, WM_QUIT};
1212
use windows::core::PCWSTR;
1313

1414
use now_proto_pdu::{NowExecDataStreamKind, NowStatusError};
@@ -657,7 +657,8 @@ fn prepare_process_with_io_redirection(
657657

658658
let startup_info = STARTUPINFOW {
659659
cb: u32::try_from(size_of::<STARTUPINFOW>()).expect("BUG: STARTUPINFOW should always fit into u32"),
660-
dwFlags: STARTF_USESTDHANDLES,
660+
dwFlags: STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW,
661+
wShowWindow: SW_HIDE.0 as u16,
661662
hStdError: stderr_write_pipe.handle.raw(),
662663
hStdInput: stdin_read_pipe.handle.raw(),
663664
hStdOutput: stdout_write_pipe.handle.raw(),

0 commit comments

Comments
 (0)