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

Issue 9863015: This is a request for comments. (Closed)

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

Description

This is a request for comments. First attempt at implementing a higher-level API for processes. Add a startNonInteractive constructor that takes a callback which is called with the exit code and the complete stdout and stderr when the process terminates. Let me know what you think. This obviously needs at least tests. Not entirely sure what I think about the interface in the first place. R=sgjesse@google.com BUG=1689 TEST= Committed: https://code.google.com/p/dart/source/detail?r=6499

Patch Set 1 #

Total comments: 18

Patch Set 2 : Introduce options object and add tests. #

Patch Set 3 : Minor indentation fixes #

Total comments: 10

Patch Set 4 : Address comments. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+434 lines, -55 lines) Patch
M runtime/bin/process.dart View 1 2 3 3 chunks +75 lines, -6 lines 0 comments Download
M runtime/bin/process_impl.dart View 1 3 chunks +156 lines, -10 lines 0 comments Download
M tests/standalone/src/io/ProcessExitTest.dart View 1 1 chunk +20 lines, -10 lines 0 comments Download
M tests/standalone/src/io/ProcessInvalidArgumentsTest.dart View 1 2 chunks +30 lines, -4 lines 0 comments Download
A tests/standalone/src/io/ProcessRunOutput.dart View 1 2 1 chunk +65 lines, -0 lines 0 comments Download
M tests/standalone/src/io/ProcessSegfaultTest.dart View 1 1 chunk +22 lines, -9 lines 0 comments Download
M tests/standalone/src/io/ProcessStartExceptionTest.dart View 1 1 chunk +27 lines, -14 lines 0 comments Download
A tests/standalone/src/io/ProcessStdIOScript2.dart View 1 1 chunk +33 lines, -0 lines 0 comments Download
M tests/standalone/src/io/ProcessWorkingDirectoryTest.dart View 1 2 chunks +6 lines, -2 lines 0 comments Download

Messages

Total messages: 14 (0 generated)
Mads Ager (google)
Request for comments.
8 years, 9 months ago (2012-03-26 23:53:26 UTC) #1
Bob Nystrom
Request granted! I don't know if you wanted comments from *me* specifically, but here they ...
8 years, 9 months ago (2012-03-27 00:20:01 UTC) #2
Mads Ager (google)
Thanks Bob! :-) https://chromiumcodereview.appspot.com/9863015/diff/1/runtime/bin/process.dart File runtime/bin/process.dart (right): https://chromiumcodereview.appspot.com/9863015/diff/1/runtime/bin/process.dart#newcode44 runtime/bin/process.dart:44: Process.startNonInteractive(String executable, On 2012/03/27 00:20:01, Bob ...
8 years, 9 months ago (2012-03-27 00:33:25 UTC) #3
Mads Ager (google)
https://chromiumcodereview.appspot.com/9863015/diff/1/runtime/bin/process.dart File runtime/bin/process.dart (right): https://chromiumcodereview.appspot.com/9863015/diff/1/runtime/bin/process.dart#newcode46 runtime/bin/process.dart:46: String workingDirectory, On 2012/03/27 00:33:25, Mads Ager wrote: > ...
8 years, 9 months ago (2012-03-27 00:46:00 UTC) #4
zundel
https://chromiumcodereview.appspot.com/9863015/diff/1/runtime/bin/process.dart File runtime/bin/process.dart (right): https://chromiumcodereview.appspot.com/9863015/diff/1/runtime/bin/process.dart#newcode29 runtime/bin/process.dart:29: * Creates a new process object and starts a ...
8 years, 9 months ago (2012-03-27 00:51:54 UTC) #5
Søren Gjesse
That was a lot of suggestions. After writing them up I currently like adding an ...
8 years, 9 months ago (2012-03-27 07:03:23 UTC) #6
zundel
https://chromiumcodereview.appspot.com/9863015/diff/1/runtime/bin/process.dart File runtime/bin/process.dart (right): https://chromiumcodereview.appspot.com/9863015/diff/1/runtime/bin/process.dart#newcode29 runtime/bin/process.dart:29: * Creates a new process object and starts a ...
8 years, 9 months ago (2012-03-27 12:33:21 UTC) #7
Mads Ager (google)
Thanks for the comments guys. It seems clear that this is one of these cases ...
8 years, 9 months ago (2012-03-27 16:56:32 UTC) #8
zundel
http://codereview.chromium.org/9863015/diff/1/runtime/bin/process.dart File runtime/bin/process.dart (right): http://codereview.chromium.org/9863015/diff/1/runtime/bin/process.dart#newcode29 runtime/bin/process.dart:29: * Creates a new process object and starts a ...
8 years, 9 months ago (2012-03-27 17:48:29 UTC) #9
Mads Ager (google)
http://codereview.chromium.org/9863015/diff/1/runtime/bin/process.dart File runtime/bin/process.dart (right): http://codereview.chromium.org/9863015/diff/1/runtime/bin/process.dart#newcode29 runtime/bin/process.dart:29: * Creates a new process object and starts a ...
8 years, 9 months ago (2012-03-27 18:09:43 UTC) #10
zundel
On 2012/03/27 18:09:43, Mads Ager wrote: > http://codereview.chromium.org/9863015/diff/1/runtime/bin/process.dart > File runtime/bin/process.dart (right): > > http://codereview.chromium.org/9863015/diff/1/runtime/bin/process.dart#newcode29 ...
8 years, 9 months ago (2012-03-27 18:32:20 UTC) #11
Mads Ager (google)
Søren, could you take another look? Introduced ProcessOptions argument. Added argument for stdout and stderr ...
8 years, 8 months ago (2012-04-12 14:19:36 UTC) #12
Søren Gjesse
lgtm https://chromiumcodereview.appspot.com/9863015/diff/10001/runtime/bin/process.dart File runtime/bin/process.dart (right): https://chromiumcodereview.appspot.com/9863015/diff/10001/runtime/bin/process.dart#newcode9 runtime/bin/process.dart:9: interface Process default _Process { As the implementation ...
8 years, 8 months ago (2012-04-12 15:02:20 UTC) #13
Mads Ager (google)
8 years, 8 months ago (2012-04-13 08:49:39 UTC) #14
https://chromiumcodereview.appspot.com/9863015/diff/10001/runtime/bin/process...
File runtime/bin/process.dart (right):

https://chromiumcodereview.appspot.com/9863015/diff/10001/runtime/bin/process...
runtime/bin/process.dart:111: * [ProcessOptions]q represents the options that
can be supplied when
On 2012/04/12 15:02:21, Søren Gjesse wrote:
> q?

Done.

https://chromiumcodereview.appspot.com/9863015/diff/10001/runtime/bin/process...
runtime/bin/process.dart:132: Encoding stdoutEncoding;
On 2012/04/12 15:02:21, Søren Gjesse wrote:
> The encodings are gnored when passing this to Process.start. Should we just
> ignore that or throw an exception if one of then are not null in that case?

I went for ignoring. I don't think it matters much as long as we document the
behavior. I would be fine with changing this if someone finds a compelling
reason to change it.

https://chromiumcodereview.appspot.com/9863015/diff/10001/runtime/bin/process...
runtime/bin/process.dart:143: Encoding stderrEncoding;
On 2012/04/12 15:02:21, Søren Gjesse wrote:
> Should there be a string or bytearray that will be piped in through stdin when
a
> process is run?

Yes, there probably should. I'll add that in a separate change. Similarly, there
should be a way to set environment variables for the spawned process.

https://chromiumcodereview.appspot.com/9863015/diff/10001/runtime/bin/process...
File runtime/bin/process_impl.dart (right):

https://chromiumcodereview.appspot.com/9863015/diff/10001/runtime/bin/process...
runtime/bin/process_impl.dart:318: if (stdoutEncoding is !Encoding) {
On 2012/04/12 15:02:21, Søren Gjesse wrote:
> Maybe we should get rid of this type check and move it to the
StringInputStream
> constructor instead.

It will throw an exception through the StringInputStream constructor in any case
if it is not one of the known encodings.

However, I like the more specific error message you get by having the check
here.

Powered by Google App Engine
This is Rietveld 408576698