Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
b9704628
Commit
b9704628
authored
Feb 04, 2011
by
Igor Egorov
Committed by
Alexandre Julliard
Feb 15, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Add stderr redirection for native Unix programs started from Windows program.
parent
82a2ec13
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
process.c
dlls/kernel32/process.c
+13
-2
No files found.
dlls/kernel32/process.c
View file @
b9704628
...
...
@@ -1449,7 +1449,7 @@ static char **build_envp( const WCHAR *envW )
static
int
fork_and_exec
(
const
char
*
filename
,
const
WCHAR
*
cmdline
,
const
WCHAR
*
env
,
const
char
*
newdir
,
DWORD
flags
,
STARTUPINFOW
*
startup
)
{
int
fd
[
2
],
stdin_fd
=
-
1
,
stdout_fd
=
-
1
;
int
fd
[
2
],
stdin_fd
=
-
1
,
stdout_fd
=
-
1
,
stderr_fd
=
-
1
;
int
pid
,
err
;
char
**
argv
,
**
envp
;
...
...
@@ -1470,25 +1470,30 @@ static int fork_and_exec( const char *filename, const WCHAR *cmdline, const WCHA
if
(
!
(
flags
&
(
CREATE_NEW_PROCESS_GROUP
|
CREATE_NEW_CONSOLE
|
DETACHED_PROCESS
)))
{
HANDLE
hstdin
,
hstdout
;
HANDLE
hstdin
,
hstdout
,
hstderr
;
if
(
startup
->
dwFlags
&
STARTF_USESTDHANDLES
)
{
hstdin
=
startup
->
hStdInput
;
hstdout
=
startup
->
hStdOutput
;
hstderr
=
startup
->
hStdError
;
}
else
{
hstdin
=
GetStdHandle
(
STD_INPUT_HANDLE
);
hstdout
=
GetStdHandle
(
STD_OUTPUT_HANDLE
);
hstderr
=
GetStdHandle
(
STD_ERROR_HANDLE
);
}
if
(
is_console_handle
(
hstdin
))
hstdin
=
wine_server_ptr_handle
(
console_handle_unmap
(
hstdin
));
if
(
is_console_handle
(
hstdout
))
hstdout
=
wine_server_ptr_handle
(
console_handle_unmap
(
hstdout
));
if
(
is_console_handle
(
hstderr
))
hstderr
=
wine_server_ptr_handle
(
console_handle_unmap
(
hstderr
));
wine_server_handle_to_fd
(
hstdin
,
FILE_READ_DATA
,
&
stdin_fd
,
NULL
);
wine_server_handle_to_fd
(
hstdout
,
FILE_WRITE_DATA
,
&
stdout_fd
,
NULL
);
wine_server_handle_to_fd
(
hstderr
,
FILE_WRITE_DATA
,
&
stderr_fd
,
NULL
);
}
argv
=
build_argv
(
cmdline
,
0
);
...
...
@@ -1527,6 +1532,11 @@ static int fork_and_exec( const char *filename, const WCHAR *cmdline, const WCHA
dup2
(
stdout_fd
,
1
);
close
(
stdout_fd
);
}
if
(
stderr_fd
!=
-
1
)
{
dup2
(
stderr_fd
,
2
);
close
(
stderr_fd
);
}
}
/* Reset signals that we previously set to SIG_IGN */
...
...
@@ -1544,6 +1554,7 @@ static int fork_and_exec( const char *filename, const WCHAR *cmdline, const WCHA
HeapFree
(
GetProcessHeap
(),
0
,
envp
);
if
(
stdin_fd
!=
-
1
)
close
(
stdin_fd
);
if
(
stdout_fd
!=
-
1
)
close
(
stdout_fd
);
if
(
stderr_fd
!=
-
1
)
close
(
stderr_fd
);
close
(
fd
[
1
]
);
if
((
pid
!=
-
1
)
&&
(
read
(
fd
[
0
],
&
err
,
sizeof
(
err
)
)
>
0
))
/* exec failed */
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment