Skip to content

Commit

Permalink
fix process for windows
Browse files Browse the repository at this point in the history
  • Loading branch information
waruqi committed Nov 26, 2022
1 parent 5b62232 commit e64ac7f
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/tbox/platform/windows/process.c
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,24 @@ tb_process_ref_t tb_process_init_cmd(tb_char_t const* cmd, tb_process_attr_ref_t
// init default std handles
if (process->psi->dwFlags & STARTF_USESTDHANDLES)
{
if (!process->psi->hStdInput) process->psi->hStdInput = GetStdHandle(STD_INPUT_HANDLE);
if (!process->psi->hStdOutput) process->psi->hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
if (!process->psi->hStdError) process->psi->hStdError = GetStdHandle(STD_ERROR_HANDLE);
if (!process->psi->hStdInput)
{
process->psi->hStdInput = GetStdHandle(STD_INPUT_HANDLE);
if (handlesToInheritCount)
handlesToInherit[handlesToInheritCount++] = process->psi->hStdInput;
}
if (!process->psi->hStdOutput)
{
process->psi->hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE);
if (handlesToInheritCount)
handlesToInherit[handlesToInheritCount++] = process->psi->hStdOutput;
}
if (!process->psi->hStdError)
{
process->psi->hStdError = GetStdHandle(STD_ERROR_HANDLE);
if (handlesToInheritCount)
handlesToInherit[handlesToInheritCount++] = process->psi->hStdError;
}
}

// init process security attributes
Expand Down

0 comments on commit e64ac7f

Please sign in to comment.