Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Issue 11474026: Fix Windows process implementation to only inherit the three (Closed)

Created:
8 years ago by Mads Ager (google)
Modified:
8 years ago
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Fix Windows process implementation to only inherit the three handles needed for stdin, stdout and stderr. R=sgjesse@google.com,ahe@google.com,kustermann@google.com BUG=dartbug.com/7191 Committed: https://code.google.com/p/dart/source/detail?r=15896

Patch Set 1 #

Total comments: 8

Patch Set 2 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+56 lines, -8 lines) Patch
M runtime/bin/process_win.cc View 1 4 chunks +56 lines, -8 lines 0 comments Download

Messages

Total messages: 9 (0 generated)
Mads Ager (google)
8 years ago (2012-12-07 16:55:55 UTC) #1
ahe
Initial comments: can you think of a way to test this? I'll take a closer ...
8 years ago (2012-12-07 17:01:21 UTC) #2
Mads Ager (google)
I had the same thought just after uploading. I can't immediately think of a good ...
8 years ago (2012-12-07 17:03:51 UTC) #3
ahe
Will this work: Start three "recursive" processes. The first waits for stdin of the sub ...
8 years ago (2012-12-07 17:17:30 UTC) #4
kustermann
It seems like this approach (passing an explicit list of handles to CreateProcess) works only ...
8 years ago (2012-12-08 11:53:42 UTC) #5
kustermann
On 2012/12/07 17:17:30, ahe wrote: > Will this work: > > Start three "recursive" processes. ...
8 years ago (2012-12-10 08:15:41 UTC) #6
Mads Ager (google)
On 2012/12/08 11:53:42, kustermann wrote: > It seems like this approach (passing an explicit list ...
8 years ago (2012-12-10 08:46:16 UTC) #7
ahe
Overall, LGTM, but it would be great with a test. https://codereview.chromium.org/11474026/diff/1/runtime/bin/process_win.cc File runtime/bin/process_win.cc (right): https://codereview.chromium.org/11474026/diff/1/runtime/bin/process_win.cc#newcode404 ...
8 years ago (2012-12-10 10:30:51 UTC) #8
Mads Ager (google)
8 years ago (2012-12-10 10:45:29 UTC) #9
https://codereview.chromium.org/11474026/diff/1/runtime/bin/process_win.cc
File runtime/bin/process_win.cc (right):

https://codereview.chromium.org/11474026/diff/1/runtime/bin/process_win.cc#ne...
runtime/bin/process_win.cc:404: GetLastError() != ERROR_INSUFFICIENT_BUFFER) {
On 2012/12/10 10:30:51, ahe wrote:
> Why are you ignoring ERROR_INSUFFICIENT_BUFFER?

I will add a comment about that. When you pass in NULL to
InitializeProcThreadAttributeList it retuns the size needed and reports
INSUFFICIENT_BUFFER. This is slightly weird but is apparently the way to use
this API to catch other potential errors.

https://codereview.chromium.org/11474026/diff/1/runtime/bin/process_win.cc#ne...
runtime/bin/process_win.cc:414: free(attribute_list);
On 2012/12/10 10:30:51, ahe wrote:
> Shouldn't you call free after getting the error message?

Yes, thanks!

https://codereview.chromium.org/11474026/diff/1/runtime/bin/process_win.cc#ne...
runtime/bin/process_win.cc:421: HANDLE* inherited_handles = new
HANDLE[num_inherited_handles];
On 2012/12/08 11:53:42, kustermann wrote:
> Is there a reason why you allocate this array on the heap and not on the
stack?

Thanks for catching that Martin. No, there is no reason for heap allocation
here.

https://codereview.chromium.org/11474026/diff/1/runtime/bin/process_win.cc#ne...
runtime/bin/process_win.cc:463: int error_code =
SetOsErrorMessage(os_error_message, os_error_message_len);
On 2012/12/10 10:30:51, ahe wrote:
> Shouldn't you call SetOsErrorMessage first?

Yes, thanks!

Powered by Google App Engine
This is Rietveld 408576698