Commit Graph

49 Commits

Author SHA1 Message Date
Zach Anderson afb490adbc [dart:io] Provide modern Dart-styled constants
This CL updates dart:io but not dart:_http. It updates the sdk sources,
the patch files, and tests.

Change-Id: I64c3da407f09fa2bc6eec582049c4ae3a8afbe6d
Reviewed-on: https://dart-review.googlesource.com/52990
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-05-03 17:00:14 +00:00
Zachary Anderson 71d356d5fe [fuchsia][dart:io] Allow the embedder to specify handles for stdio
The content handlers on Fuchsia can potentially give each Isolate
different handles to use for stdout and stderr. This change provides
a hook for an embedder to call to supply the handles to Dart, and
removes hardcoding of stdio handles to 0, 1, 2.

Change-Id: Ic03b77adc9a911e9c754562fa6a91f9929e10dfc
Reviewed-on: https://dart-review.googlesource.com/36122
Commit-Queue: Zach Anderson <zra@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2018-01-22 21:09:39 +00:00
Peter von der Ahé e8aef37eac Clean up patches so they can be compiled by Fasta.
Change-Id: Ie436375c78496366accf0ba82938e54cbe30b143
Reviewed-on: https://dart-review.googlesource.com/3001
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2017-10-05 14:05:50 +00:00
Zachary Anderson fc41a57a93 [dart:io] Allow an embedder to disallow certain operaions
Fuchsia's Dart and Flutter content handlers share the implementation of
dart:io with the command line embedder, but would like to disable
some operations that don't make sense for them, like exiting thoe whole
process, which may be hosting multiple unrelated Isolates.
Change-Id: I825ece49c685471ff85802873b1c0f974c507aed
Reviewed-on: https://dart-review.googlesource.com/3687
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2017-09-08 05:02:07 +00:00
Jacob Richman b67e83eea3 Format all remaining unformatted runtime files other than multitests.
BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2829463003 .
2017-04-18 15:34:03 -07:00
Zachary Anderson 8c9c54d833 [dart:io] Don't close stdin with a socket finalizer
If an Isolate touches the 'stdio' getter, a _NativeSocket with
attached finalizer is created for it. Previously, when such an
Isolate exited, the finalizer would close the underlying
file descriptor. This CL changes the finalizer for stdin such
that the native objects will be cleaned up, but the underlying
file descriptor will not be closed. The underlying file
descriptor will now only be closed if the stdin stream
subscription is explicitly canceled.

Accessing the stdin getter after the stream is explicitly
canceled will result in a FileSystemException.

See also: https://github.com/dart-lang/test/issues/583

fixes #29229

R=rmacnak@google.com

Review-Url: https://codereview.chromium.org/2791423002 .
2017-04-04 13:57:42 -07:00
Jacob Richman 4360e99d18 Revert "Fix observatory tests broken by running dartfmt."
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.

BUG=

Committed: https://github.com/dart-lang/sdk/commit/62be0eacfbb36bdc92a05c7c35bb4506621b6a3a
Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-21 10:07:26 -07:00
Jacob Richman 62be0eacfb Revert "Fix observatory tests broken by running dartfmt."
This reverts commit b1f7e6d94673b098c93c187fe3efc45c15f27edc.

BUG=

Review-Url: https://codereview.chromium.org/2767533002 .
2017-03-20 22:19:22 -07:00
Jacob Richman 88f8aacd5f Re-apply rolled back CL to apply dartfmt to runtime.
Fix observatory tests broken by running dartfmt due to line and column changes.
Temporarily reverted formatting for evaluate_activation_test.dart as dartfmt doesn't yet handle multitests.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2759973004 .
2017-03-20 21:44:59 -07:00
Ryan Macnak ea4744a06f Revert "Run dartfmt on all files under runtime."
This reverts commit 15f393f189.

The change caused many service test failures due to changed line numbers.

TBR=jacobr@google.com

Review-Url: https://codereview.chromium.org/2762583003 .
2017-03-20 13:42:55 -07:00
Jacob Richman 15f393f189 Run dartfmt on all files under runtime.
I've omitted files where the formatter output is significantly uglier
than the original code and I'll send those files in a separate CL
with options for how to make the code look reasonable while still
taking advantage of the formatter.

BUG=
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2751423005 .
2017-03-20 13:13:50 -07:00
Zach Anderson b3093ecee6 [dart:io] Move Platform.ansiSupported to {Stdin,Stdout}.supportsAnsiEscapes
On Windows, some Windows 10 builds support only ANSI output, but not
input, so these need to be separated.

I'm also improving the detection on Mac and Linux to avoid hardcoding
the result. Instead, supportsAnsiEscapes will be true if isatty() and
the TERM environment variable contains the string 'xterm'.

related #28614

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2753233002 .
2017-03-17 12:35:36 -07:00
Zach Anderson 9506cb9975 Error checking for Stdio calls
R=johnmccutchan@google.com

Review-Url: https://codereview.chromium.org/2585443002 .
2016-12-15 11:12:42 -08:00
Vyacheslav Egorov 23fd1a184b VM: Support bootstrapping core libraries from Kernel binaries instead of source.
BUG=http://dartbug.com/27590
R=asiva@google.com

Review URL: https://codereview.chromium.org/2485993002 .
2016-11-16 13:56:20 +01:00
Vyacheslav Egorov eb8c24e133 Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2451623006 .
2016-10-27 10:09:22 +02:00
Vyacheslav Egorov 12968edb9c Revert "Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork.""
This reverts commit 4e7a31262e.

Windows bots are broken now.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2451893004 .
2016-10-26 17:07:18 +02:00
Vyacheslav Egorov 4e7a31262e Reland "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This relands commit 2fed1c3905 with fixes to ensure that analyzer summaries are correctly created and XARM build does not try to use target binaries on the host.

R=zra@google.com
BUG=

Review URL: https://codereview.chromium.org/2453773002 .
2016-10-26 16:48:28 +02:00
Vyacheslav Egorov cf7ff42e60 Revert "Merge more Kernel infrastructure from kernel_sdk SDK fork."
This reverts commit 2fed1c3905.

SDK builds are failing

TBR=zra@google.com

Review URL: https://codereview.chromium.org/2455593002 .
2016-10-26 13:06:27 +02:00
Vyacheslav Egorov 2fed1c3905 Merge more Kernel infrastructure from kernel_sdk SDK fork.
- bring patched SDK generation scripts and VM patch tweaks that allow VM patch files to be parsed by analyzer front-end;
  Patched SDK is an SDK with all VM patches spliced into it. Kernel compiler is based on the analyzer front-end which does
  not have any patch files support/model so for it to produce Kernel files that match VM we need to generate a such patched SDKs.

- bring test script modifications that allow to test Kernel pipeline

BUG=
R=asiva@google.com, kmillikin@google.com, whesse@google.com, zra@google.com

Review URL: https://codereview.chromium.org/2434123003 .
2016-10-26 13:02:54 +02:00
Matthias Hausner 1a6d1eca32 Implement @patch annotation for patch class members
Allow members of patch classes to be annotated with @patch. The VM
ignores the annotation. I simply replaces the original method
if the name matches, or reports an error if field names match.

Adding a bit is_patched to members to do more checking remains a
TODO. There are currently no unused bits available, and I don’t want
to increase the size of Function objects for this.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org/2230383003 .
2016-08-10 12:54:57 -07:00
Matthias Hausner e11ca24053 Use metadata annotation @patch for patch classes
Annotate patch classes and top-level patch functions with @patch
instead of the pseudo-keyword patch. This allows the analyzer
to read patch files, and matches the syntax that dart2js uses.

The deprecated syntax is still supported, but a warning is printed when detected.

BUG=

Review URL: https://codereview.chromium.org/2220883004 .
2016-08-09 09:48:03 -07:00
Florian Loitsch e3c3f099ea Fix strong mode errors in dart:io.
Still a lot of strong mode warnings left.

R=fschneider@google.com, sgjesse@google.com

Committed: https://github.com/dart-lang/sdk/commit/5216f1d67d09d289f7c7ceab56a64ce0dcb7d563

Reverted: https://github.com/dart-lang/sdk/commit/7503ecc8fdb32747b2b05b529219ce83da8f0b6c

Review URL: https://codereview.chromium.org/1904553006 .
2016-05-12 13:17:31 +02:00
Florian Loitsch 7503ecc8fd Revert "Fix strong mode errors in dart:io."
This reverts commit 5216f1d67d.

BUG=

Review URL: https://codereview.chromium.org/1966373002 .
2016-05-11 21:44:09 +02:00
Florian Loitsch 5216f1d67d Fix strong mode errors in dart:io.
Still a lot of strong mode warnings left.

R=fschneider@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org/1904553006 .
2016-05-11 14:30:32 +02:00
John McCutchan b2249f30fd Add persistent handles to service protocol and Observatory UI
VM Changes:

- Add private _getPersistentHandles service RPC.
- Add service_test for _getPersistentHandles.

Observatory Changes:

- Add Persistent Handles page.
- Display persistent handles in a curly-block
- Display weak persistent handles in a sortable table.

R=rmacnak@google.com

Review URL: https://codereview.chromium.org/1719313002 .
2016-03-01 07:31:29 -08:00
Anders Johnsen 54b7e9fec4 Fix arguments passed to FileSystemException from _socketType, when failing to resolve the type.
BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//1293433003 .
2015-08-13 09:32:26 +02:00
sgjesse@google.com 30ae29f4f2 Reapply revert of "Make stdout/stderr async"
This re-applies r42909 which was reverted in r42910 with a few fixes.

TBR=ajohnsen@google.com
BUG=

Review URL: https://codereview.chromium.org//851253002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42953 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-16 13:35:37 +00:00
sgjesse@google.com c831cdf97f Revert "Revert "Make stdout/stderr async""
This reverts commit r42909

TBR=ricow@google.com
BUG=

Review URL: https://codereview.chromium.org//850333002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42910 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 14:33:35 +00:00
sgjesse@google.com bc1be9c45f Revert "Make stdout/stderr async"
This makes writes to the stdout and stderr IOSinks in dart:io blocking again.

To get the non-blocking behaviour the getter "nonBlocking" will return an
IOSink with real non-blocking behaviour.

Updated the class exposed for stderr to also support checking for whether it
is connected to a terminal and checking the terminal size.

R=ajohnsen@google.com, iposva@google.com

BUG=

Review URL: https://codereview.chromium.org//807833002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42909 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 14:18:16 +00:00
sgjesse@google.com 65e1149f8c Make stdout/stderr async
This makes stdout.write and stderr.write async.

This effectively reverts https://code.google.com/p/dart/source/detail?r=33645

Reapplies r41350 after the dart2js batch-runner have been changed to handle
async stdout/stderr.

R=ricow@google.com
BUG=

Review URL: https://codereview.chromium.org//693793002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41436 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-31 12:11:53 +00:00
sgjesse@google.com b6d16215aa Revert "Make stdout/stderr async"
This reverts r41350.

There are test-failures that needs to be analyzed.

TBR=iposva@google.com, ajohnsen@google.com
BUG=

Review URL: https://codereview.chromium.org//686703002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41353 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-28 09:07:56 +00:00
sgjesse@google.com c50df5e563 Make stdout/stderr async
This makes stdout.write and stderr.write async.

This effectively reverts https://code.google.com/p/dart/source/detail?r=33645

R=iposva@google.com, ajohnsen@google.com
BUG=

Review URL: https://codereview.chromium.org//673193002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@41350 260f80e4-7a28-3924-810f-c04153c831b5
2014-10-28 08:53:10 +00:00
ajohnsen@google.com a08b282ee8 Use a sync-writing StreamConsumer for stdout/stderr.
This makes stdout.write and stderr.write block, until the write is done.

BUG=https://code.google.com/p/dart/issues/detail?id=17020
R=whesse@google.com

Review URL: https://codereview.chromium.org//195893012

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33645 260f80e4-7a28-3924-810f-c04153c831b5
2014-03-13 11:20:34 +00:00
ajohnsen@google.com 0f52be7f63 Make std* blocking file-descriptors.
This will most likely be a performance regression when piping, that
we'll have to look into in the future (copying data through
    message-passing).

BUG=
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//154273003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@32715 260f80e4-7a28-3924-810f-c04153c831b5
2014-02-17 10:06:35 +00:00
ajohnsen@google.com 7a8abc62b7 Fix Stdout in checked mode.
BUG=

Review URL: https://codereview.chromium.org//119183002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31263 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-19 12:26:27 +00:00
ajohnsen@google.com 5e564f370d Add getter for hasTerminal, terminalColumns and terminalLines on stdin.
BUG=https://code.google.com/p/dart/issues/detail?id=15557
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//102123010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31255 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-19 10:59:58 +00:00
ajohnsen@google.com c88afd2ca4 Add getter for lineMode and echoMode for Stdin.
BUG=https://code.google.com/p/dart/issues/detail?id=15424
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//102953008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31103 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-12 16:42:26 +00:00
ajohnsen@google.com 103eac574c Remove FileException, DirectoryException and LinkException from dart:io and use FileSystemException instaed.
BUG=https://code.google.com/p/dart/issues/detail?id=12461
R=nweiz@google.com, sgjesse@google.com

Review URL: https://codereview.chromium.org//26968003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@29168 260f80e4-7a28-3924-810f-c04153c831b5
2013-10-24 12:17:20 +00:00
ajohnsen@google.com 4b4f0307ba Add echo and line modes to Stdin.
BUG=https://code.google.com/p/dart/issues/detail?id=8190,https://code.google.com/p/dart/issues/detail?id=9825,https://code.google.com/p/dart/issues/detail?id=11659
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//19627004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25413 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-24 13:51:55 +00:00
ajohnsen@google.com 908bf5b435 Fix Stdio->Stdin typo and missing external.
BUG=

Review URL: https://codereview.chromium.org//18532002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24685 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-02 13:29:34 +00:00
ajohnsen@google.com 8aa206940c Add Stdio.readByteSync and Stdio.readLineSync.
BUG=https://code.google.com/p/dart/issues/detail?id=7136
R=whesse@google.com

Review URL: https://codereview.chromium.org//18516002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24684 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-02 13:18:00 +00:00
ajohnsen@google.com 5ce3b9ddea Clean up dart:io exceptions.
- Introduce IOException.
- Remove HttpParserException.
- Merge RedirectLimitExceededException and RedirectLoopException into
RedirectException.
- Remove 'IO' from FileIOException, DirectoryIOException, LinkIOException
and SocketIOException.

BUG=https://code.google.com/p/dart/issues/detail?id=9955
R=sgjesse@google.com

Review URL: https://codereview.chromium.org//16123036

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@23848 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-11 13:15:46 +00:00
ajohnsen@google.com ea312dd9e3 Also wrap stdin/stdout/stderr on Process.
BUG=https://code.google.com/p/dart/issues/detail?id=9439

Review URL: https://codereview.chromium.org//13929002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21132 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-09 06:21:17 +00:00
ajohnsen@google.com 140409a05a Wrap stdout/stderr/stdin to only expose the relevant methods.
BUG=https://code.google.com/p/dart/issues/detail?id=9439,https://code.google.com/p/dart/issues/detail?id=9593

Review URL: https://codereview.chromium.org//13787003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21063 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-08 12:13:03 +00:00
sgjesse@google.com e40ce105af Fix a number of issues with determining the type of stdio
* Fix checked mode exception when _getSocketType returns an OSError
 * Treat any character device as terminal (this includes /dev/null)
 * Fix detecting of file redirection af file
 * Don't turn an unkonwn device type into an OSError (wth value for an unknown was -1)

Expanded an existing test to catch some of this.

R=ager@google.com

BUG=https://code.google.com/p/dart/issues/detail?id=9637

Review URL: https://codereview.chromium.org//13636003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@20960 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-05 11:13:24 +00:00
sgjesse@google.com 488b016a2f Merge IO v2 branch to bleeding edge
R=ager@google.com, ajohnsen@google.com, whesse@google.com

BUG=

Review URL: https://codereview.chromium.org//12316036

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18820 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-21 11:58:11 +00:00
sgjesse@google.com 800b4b6c37 Add function for finding what a InputStream or OutputStream is attached to
For the dart:io types InputStream and OutputStream the top level
function stdioType will return whether the stream is attached to a
terminal, pipe, file or something else.

BUG=dart:2789

R=ager@google.com

Review URL: https://codereview.chromium.org//11773041

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16839 260f80e4-7a28-3924-810f-c04153c831b5
2013-01-09 09:17:07 +00:00
ager@google.com 81ea12b120 Fix unresolved classes issues in dart:io.
R=sgjesse@google.com
BUG=dartbug.com/7299

Review URL: https://codereview.chromium.org//11553020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16026 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-12 09:23:57 +00:00
ager@google.com aac030e777 Use patching for dart:io.
This allows the tools such as dartdoc to operate on dart:io
in the same way as it does with other code and allows the
implemenation of parts of dart:io for dart2js if we ever
want to do that.

The current patching is very VM specific. I have only moved
stuff to patch files when they actually need to be. For
Process and Socket everything has to be moved because they
use native fields. For the rest, only the individual native
calls have been put in patch files.

R=sgjesse@google.com,ajohnsen@google.com
BUG=

Review URL: https://codereview.chromium.org//11337019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14259 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 10:32:30 +00:00