CreateProcess with CREATE_NO_WINDOW flag (#413)
* createProcess() should spawn a new process with an invisible console window.
This commit is contained in:
parent
4ea214bf8d
commit
8cf6003bac
|
@ -1067,6 +1067,7 @@ spawn_child_internal(char* cmd, char *const argv[], HANDLE in, HANDLE out, HANDL
|
|||
si.hStdOutput = out;
|
||||
si.hStdError = err;
|
||||
si.dwFlags = STARTF_USESTDHANDLES;
|
||||
flags |= CREATE_NO_WINDOW;
|
||||
|
||||
wchar_t * t = cmdline_utf16;
|
||||
do {
|
||||
|
|
|
@ -73,6 +73,7 @@ int exec_command_with_pty(int * pid, char* cmd, int in, int out, int err, unsign
|
|||
int ret = -1;
|
||||
HANDLE ttyh = (HANDLE)w32_fd_to_handle(ttyfd);
|
||||
wchar_t * cmd_w = NULL;
|
||||
unsigned long flags = 0;
|
||||
|
||||
if ((cmd_w = utf8_to_utf16(cmd)) == NULL) {
|
||||
errno = ENOMEM;
|
||||
|
@ -121,8 +122,9 @@ int exec_command_with_pty(int * pid, char* cmd, int in, int out, int err, unsign
|
|||
si.hStdError = ttyh;
|
||||
}
|
||||
|
||||
flags = CREATE_NO_WINDOW;
|
||||
debug3("pty commandline: %ls", pty_cmdline);
|
||||
if (CreateProcessW(NULL, pty_cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi)) {
|
||||
if (CreateProcessW(NULL, pty_cmdline, NULL, NULL, TRUE, flags, NULL, NULL, &si, &pi)) {
|
||||
if (register_child(pi.hProcess, pi.dwProcessId) == -1) {
|
||||
TerminateProcess(pi.hProcess, 0);
|
||||
CloseHandle(pi.hProcess);
|
||||
|
|
|
@ -8,7 +8,7 @@ Import-Module .\openssh-portable\contrib\win32\openssh\OpenSSHTestHelper.psm1
|
|||
Setup-OpenSSHTestEnvironment
|
||||
```
|
||||
|
||||
`Setup-OpenSSHTestEnvironment` contains below parameters:
|
||||
`Set-OpenSSHTestEnvironment` contains below parameters:
|
||||
* `-OpenSSHBinPath`: Specify the location where ssh.exe should be picked up. If not specified, the function will prompt to user if he/she want to choose the first ssh.exe found in `$env:path` if exists.
|
||||
* `-TestDataPath`: Specify the location where the test binaries deploy to. The default is `$env:SystemDrive\OpenSSHTests` if it not specified.
|
||||
* `-Quiet`: If it is set, the function will do all the changes without prompting to user to confirm.
|
||||
|
|
Loading…
Reference in New Issue