Zach Anderson
2b48261764
Fix Process.runSync error handling.
...
Now, failing to allocate a buffer for stderr or stdout will generate
an ENOMEM OSError exception.
Also previously, read() returning an error would cause buffers for
stderr and stdout to leak. After this change, they'll be reclaimed.
R=asiva@google.com
Review-Url: https://codereview.chromium.org/2596543002 .
2016-12-21 09:10:40 -08:00
Zachary Anderson
479a97b129
clang-format runtime/bin
...
R=johnmccutchan@google.com
Review URL: https://codereview.chromium.org/2480793002 .
2016-11-04 12:30:56 -07:00
Ryan Macnak
4d65db8a95
Don't use IsolateData for the exit hook as multiple embedders share the dart/bin while using different isolate data structures.
...
Issue flutter/flutter#6506
R=asiva@google.com
Review URL: https://codereview.chromium.org/2463923002 .
2016-10-31 15:56:25 -07:00
Zachary Anderson
7308e58c3f
Really remove io support when dart:io is unsupported.
...
Previously we would compile in implementaitions of native calls for
IO functions that would never be used. This CL provides implementations
that throw a Dart exception if they're called by mistake. It also uses
a DART_IO_DISABLED preprocessor define to clean up the build files and
check that we're not including code we shouldn't.
R=iposva@google.com , johnmccutchan@google.com
Review URL: https://codereview.chromium.org/1839463002 .
2016-03-29 11:22:03 -07:00
Zachary Anderson
45661a7091
Cleanup in //runtime/bin
...
R=iposva@google.com
Review URL: https://codereview.chromium.org/1800863002 .
2016-03-16 10:01:00 -07:00
Zachary Anderson
c75a817ee0
Fixes some memory leaks in //runtime/bin
...
Also some style cleanups.
Decided to fix these leaks by using Dart_ScopeAllocate
instead of malloc and new. Leaks are noted in the CL.
I haven't finished looking over all the code in
//runtime/bin yet, but this CL was getting big.
Review URL: https://codereview.chromium.org/1781883002 .
2016-03-14 11:08:52 -07:00
Soren Gjesse
0415d9271d
Improve the encoding/decoding to/from system encoding on Windows
...
On Windows the dart:io SYSTEM_ENCODING is now also working with strings
which have null characters in them. Previously the string would be
terminated at the null character.
BUG=https://github.com/dart-lang/sdk/issues/23295
R=kustermann@google.com , lrn@google.com
Review URL: https://codereview.chromium.org//1194883002 .
2015-06-24 10:36:05 +02:00
sgjesse@google.com
9aa4805e21
Add an option for starting a detached process with stdio connected
...
R=lrn@google.com , kustermann@google.com
BUG=
Review URL: https://codereview.chromium.org//890633002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43393 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-03 13:38:38 +00:00
sgjesse@google.com
f6a10fbdf1
Add support for starting a detached process
...
BUG=http://dartbug.com/20970
R=kustermann@google.com , lrn@google.com
Review URL: https://codereview.chromium.org//798743004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43070 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-22 11:49:39 +00:00
iposva@google.com
5a383e7add
- Make sure that the threads for dart::bin are in the correct namespace.
...
R=asiva@google.com
Review URL: https://codereview.chromium.org//471743002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39233 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-14 00:06:04 +00:00
iposva@google.com
14ecdbd66a
- Separate the thread implementation used in bin/ and vm/
...
to allow us to make VM specific changes.
R=asiva@google.com
Review URL: https://codereview.chromium.org//463993002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@39172 260f80e4-7a28-3924-810f-c04153c831b5
2014-08-12 23:19:53 +00:00
ajohnsen@google.com
6906b3ba5f
Fix listening for multiple signals.
...
BUG=https://code.google.com/p/dart/issues/detail?id=18793
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//285023002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@36153 260f80e4-7a28-3924-810f-c04153c831b5
2014-05-14 09:36:03 +00:00
ajohnsen@google.com
38d0fad2c7
Signal handling, take 2.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//119093007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31276 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-19 15:07:48 +00:00
ajohnsen@google.com
f24f568571
Revert "Signal handling."
...
This reverts commit r31270.
BUG=
Review URL: https://codereview.chromium.org//105083009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31275 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-19 14:03:15 +00:00
ajohnsen@google.com
e8d9794c70
Signal handling.
...
BUG=
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//108003009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@31270 260f80e4-7a28-3924-810f-c04153c831b5
2013-12-19 13:08:26 +00:00
sgjesse@google.com
b8912cff07
Replace the memcpy macro with a lint check.
...
This fixes the build under libc++. It also allows us to check the
Windows and Android code. While at it, replace all uncaught instances
of memcpy with memmove.
R=sgjesse@google.com
Review URL: https://codereview.chromium.org//23578046
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27700 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-20 12:25:08 +00:00
sgjesse@google.com
650dc5f135
Remove duplicated code on Windows
...
This also gives a litle more info when FormatMessageW fails.
R=whesse@google.com
BUG=
Review URL: https://codereview.chromium.org//23463044
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27639 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-19 06:33:28 +00:00
sgjesse@google.com
959456533f
Add Process.runSync for running processes synchronously
...
BUG=http://dartbug.com/1707
R=whesse@google.com
Review URL: https://codereview.chromium.org//21816002
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26052 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-13 14:12:31 +00:00
ajohnsen@google.com
900dba8e03
Remove static mutexes/monitors from dart:io.
...
BUG=
R=whesse@google.com
Review URL: https://codereview.chromium.org//18080010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@24576 260f80e4-7a28-3924-810f-c04153c831b5
2013-06-28 08:44:15 +00:00
smok@google.com
ebbc2020a2
Put everything in runtime/bin into '::dart::bin' namespace.
...
Review URL: https://codereview.chromium.org//14341015
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@22032 260f80e4-7a28-3924-810f-c04153c831b5
2013-04-25 14:22:30 +00:00
iposva@google.com
9046a44a37
Prepare for removal of source_filter.gypi:
...
- Guard OS-dependent source files with #if TARGET_OS_* in a similar
fashion to the architecture dependent sources.
Review URL: https://codereview.chromium.org//12282051
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@18786 260f80e4-7a28-3924-810f-c04153c831b5
2013-02-20 21:17:38 +00:00
ager@google.com
60c599f5d1
Be explicit about use of W version on Windows.
...
The trunk builder is unhappy. I don't understand why since we are
defining UNICODE and _UNICODE in our header files. However, let's
just be explicit.
R=sgjesse@google.com ,ricow@google.com
BUG=
Review URL: https://codereview.chromium.org//11639017
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16322 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-19 14:37:14 +00:00
ager@google.com
406617e179
Fix Windows XP process handling.
...
ProcThreadAttributeLists are not supported on Windows XP so we need
to dynamically load the functions and check that they exist. This
of course means that file descriptors are inherited on XP, but we
knew that already.
R=sgjesse@google.com
BUG=dartbug.com/7492
Review URL: https://codereview.chromium.org//11637014
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16309 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-19 10:10:01 +00:00
ager@google.com
1fe5a6d631
Complete the transition to unicode APIs on Windows.
...
Define _UNICODE and UNICODE so that we do not add accidental
dependencies on non-unicode APIs.
Reapply the change without the completely broken code in
socket_win.cc. Instead use 'A' versions explicitly.
R=sgjesse@google.com ,antonm@google.com
Review URL: https://codereview.chromium.org//11564017
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16122 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-13 15:51:48 +00:00
ager@google.com
0952f0a37f
Revert last unicode change. Causes Pub issues.
...
R=sgjesse@google.com
BUG=
Review URL: https://codereview.chromium.org//11570006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16105 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-13 12:56:02 +00:00
ager@google.com
2a3c575b79
Complete the transition to unicode APIs on Windows.
...
Define _UNICODE and UNICODE so that we do not add accidental
dependencies on non-unicode APIs.
Anton, this could have an influence on Dartium builds as well?
R=sgjesse@google.com ,antonm@google.com
BUG=
Review URL: https://codereview.chromium.org//11567010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16104 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-13 12:43:01 +00:00
ager@google.com
8d523fead9
Use unicode versions of process APIs on Windows. Additionally,
...
retrieve the arguments to dart as unicode strings.
R=sgjesse@google.com
BUG=
Review URL: https://codereview.chromium.org//11565008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16093 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-13 09:24:05 +00:00
ager@google.com
8a14c1c319
Use FormatMessageW for Windows error messages to handle internationalized messages correctly.
...
R=sgjesse@google.com
BUG=dartbug.com/6986
Review URL: https://codereview.chromium.org//11558012
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16041 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-12 14:39:21 +00:00
ager@google.com
3d5ed6402c
Fix Windows process implementation to only inherit the three handles needed for stdin, stdout and stderr.
...
This time without attempting to update test binaries.
R=kustermann@google.com
Review URL: https://codereview.chromium.org//11497007
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15898 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-10 12:15:51 +00:00
ager@google.com
5c48ccc7df
Revert update of stable test binary.
...
R=kustermann@google.com
BUG=
Review URL: https://codereview.chromium.org//11474053
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15897 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-10 11:55:15 +00:00
ager@google.com
88a5725b48
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
Review URL: https://codereview.chromium.org//11474026
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15896 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-10 11:51:37 +00:00
gram@google.com
3601944836
Revised CL for customisable logging (replacing printfs).
...
Review URL: https://codereview.chromium.org//11312242
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15096 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-19 17:38:15 +00:00
ager@google.com
28b43144e5
Update dart:io to convert strings between UTF8 and current code page
...
when interacting with the system.
What we get from and need to hand to the VM is utf8. What we
get from and need to hand to the system is in the current
code page.
R=sgjesse@google.com
BUG=
Review URL: https://codereview.chromium.org//11275281
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14851 260f80e4-7a28-3924-810f-c04153c831b5
2012-11-13 15:03:23 +00:00
ager@google.com
79a0089d38
Change Process.kill to return a boolean instead of throwing an exception when kill fails.
...
If the program wants to kill the process after a given time, it is
possible that the process is already dead but has not yet been
reaped. Therefore, there is no way for the programmer to test if the
process is already dead before killing it. Throwing an exception from
kill is not helpful as you will most often have to catch it and do
nothing because you cannot prevent the exception occasionally and
there is nothing you can do as a result of the exception since it
usually means that the process is already dead.
R=ahe@google.com ,sgjesse@google.com
BUG=
Review URL: https://codereview.chromium.org//11238057
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13956 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-23 12:40:53 +00:00
ager@google.com
ff9e0f75fb
Change Process.start to return a future that completes with a
...
Process object only when the process has been successfully started.
This is less error prone since you can use all the methods on a
Process object as soon as you can get your hands on it. Unfortunately,
this change leads to quite a few changes in test.dart. Some of those
changes will fix bugs as well. We used to have a problem with a
timeout that could fire just in between two steps in a chain of
commands that constitute one test run. This change should address
that issue as well.
BUG=dartbug.com/5305
Review URL: https://codereview.chromium.org//11091070
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@13729 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-17 10:57:45 +00:00
whesse@google.com
bb7c2d9969
Fix dart:io Process class on the Windows plaform, which had some race conditions.
...
BUG=dart:4414
Review URL: https://chromiumcodereview.appspot.com//10825473
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@11050 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-21 14:24:22 +00:00
whesse@google.com
99e64f84c2
Fix dart:io Process callback on Windows platfrom calling convention from cdecl to stdcall.
...
BUG=dart:4414
Review URL: https://chromiumcodereview.appspot.com//10836337
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@10946 260f80e4-7a28-3924-810f-c04153c831b5
2012-08-20 12:32:19 +00:00
cshapiro@google.com
772a399cab
Emit symbol maps for compiled code for use by the Linux perf tool.
...
Review URL: https://chromiumcodereview.appspot.com//10831005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9922 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-26 00:21:25 +00:00
whesse@google.com
d05e40212a
IO: Fix error in Process exit handling.
...
BUG=3639
TEST=
Review URL: https://chromiumcodereview.appspot.com//10697066
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@9336 260f80e4-7a28-3924-810f-c04153c831b5
2012-07-03 10:16:25 +00:00
ajohnsen@google.com
c54800f942
Give Process.kill an optional argument to specify which signal to send.
...
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//10545134
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@8541 260f80e4-7a28-3924-810f-c04153c831b5
2012-06-12 12:00:50 +00:00
ager@google.com
eb9744b3bb
Process exit code handling reworked for Windows.
...
Simplify the code by relying on the builtin Windows thread pool
to wait for all process handles. The additional benefit is that
we can have an arbitrary number of processes and are not restricted
by the max number of handles for WaitForMultipleObjects.
R=sgjesse@google.com
BUG=dartbug:1450
TEST=standalone/io/process_many_test.dart
Review URL: https://chromiumcodereview.appspot.com//10440044
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@7995 260f80e4-7a28-3924-810f-c04153c831b5
2012-05-25 13:10:03 +00:00
ager@google.com
493a76dd40
Support passing an environment variable map to child processes.
...
Fix minor type warning in test.
Reapplication after MacOS bug fix.
R=sgjesse@google.com
BUG=dartbug.com/2193
TEST=
Review URL: https://chromiumcodereview.appspot.com//10166029
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6827 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-23 07:54:10 +00:00
ager@google.com
c5d347fcbc
Revert "Support passing an environment variable map to child processes."
...
Apparently the code or the test is broken on Mac.
R=sgjesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//10163004
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6795 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-20 12:53:19 +00:00
ager@google.com
ee81b6f0a1
Support passing an environment variable map to child processes.
...
Fix minor type warning in test.
R=sgjesse@google.com
BUG=dartbug.com/2193
TEST=
Review URL: https://chromiumcodereview.appspot.com//10127008
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6794 260f80e4-7a28-3924-810f-c04153c831b5
2012-04-20 12:38:57 +00:00
ager@google.com
357588d0c9
Change quoting in Process implementation on Windows.
...
Only quote command and arguments if they contain a space or a tab.
This seems consistent with the way it is handled in other systems.
R=antonm@google.com ,sgjesse@google.com
Review URL: https://chromiumcodereview.appspot.com//9701061
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5522 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-15 15:33:06 +00:00
ager@google.com
c96189c6a9
Wrap all arguments passed to processes in "" on Windows.
...
I'm not 100% sure that this is what we want. I'll dig into
what other systems are doing tomorrow.
This could make the test scripts work on Windows for Dartium.
Updated windows test binary as well.
R=antonm@google.com ,sgjesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9699032
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@5472 260f80e4-7a28-3924-810f-c04153c831b5
2012-03-14 16:50:16 +00:00
ager@google.com
37499dce81
Rework Windows process handling.
...
- Use only one thread to wait for multiple process objects.
- Fix issue where reading from a closed pipe would print an
error message on stderr.
- Remove the need to go to dart before removing a processinfo
object from the list. Sometimes you never get there so we
have to remove the process info object always.
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9310053
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3844 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-02 13:47:42 +00:00
ager@google.com
ed3338dbae
Wait for exit-code thread to terminate before terminating main.
...
The code is identical on Linux and Mac. Currently unimplemented on
Windows because I had to revert my change to the exit code handling
on Windows. I will revive that change tomorrow and implement this
as part of that change.
R=iposva@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9315037
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3801 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 18:16:45 +00:00
ager@google.com
7031be2291
Revert "Changes to the process implementation."
...
There is a race-condition on Windows and exit handling when a process
has been closed is incorrect.
R=sgjesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9307033
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3790 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 14:19:25 +00:00
ager@google.com
6b5815328c
Changes to the process implementation.
...
- Make the list of active processes thread safe on Windows.
- Use only one thread on Windows to detect process termination.
- Stop the process termination thread when the standalone VM terminates.
R=sgjesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9307003
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3780 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-01 09:09:23 +00:00