Commit Graph

45 Commits

Author SHA1 Message Date
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
ager@google.com 607eea1402 Cleanup gypi mess.
My change that introduced a platform directory shared between vm and bin runtime components did not correctly update gypi files.

BUG=
TEST=

Review URL: http://codereview.chromium.org//9124030

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3155 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-10 16:50:14 +00:00
ager@google.com c4c92c4f7b Introduce runtime/platform directory for code shared between vm
and bin.

Cleaned up globals.h. Common parts now in platform/globals.h.
vm specific parts are in vm/globals.h and bin/globals.h is gone.

R=sgjesse@google.com,iposva@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//9114008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3030 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-06 11:28:21 +00:00
ajohnsen@google.com c2b45bf04e Add optional workingDirectory argument to Process.start.
Review URL: http://codereview.chromium.org//9108008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2987 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-05 09:54:54 +00:00
ager@google.com 47a7c9bcdb Undo change that converted exit code 255 to -1.
It seems that most systems do not perform that conversion and it
could therefore be confusing.

Simplify the crash handling in the test scripts accordingly.

R=sgjesse@google.com
BUG=
TEST=

Review URL: http://codereview.chromium.org//8989011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@2620 260f80e4-7a28-3924-810f-c04153c831b5
2011-12-20 10:06:35 +00:00
sgjesse@google.com 04bc611751 Handle stdin/stdout/stderr on Windows
Create handle objects for stdin/stdout/stderr. For Mac OS and
Linus the file descriptor numbers are used but on Windows the
handles are wrapped in an object.

The system handles for stdin/stdout/stderr on Windows does not
support overlapped IO. To mittigate this the write calls are
performed synchronously and the read calls are preformed in a
thread which posts the result through the completion potr where
it is handled as if it originated from overlapped IO through the
completion port. For now each call to read starts a new thread.

R=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8574002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1533 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-15 13:19:07 +00:00
ager@google.com f789c40d85 Correct the sign of exit codes for the process library.
BUG=
TEST=

Review URL: http://codereview.chromium.org//8506013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1356 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-09 15:37:40 +00:00
sgjesse@google.com 7041797907 Get the OS error message for process exceptions on Windows
R=ager@google.com
Review URL: http://codereview.chromium.org//8277035

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@435 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-14 13:03:39 +00:00
sgjesse@google.com 82312e0130 Use UUIDs for named pipe names on Windows instead of counter
R=ager@google.com
Review URL: http://codereview.chromium.org//8276002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@422 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-14 07:34:05 +00:00
sgjesse@google.com b98198c894 Make sure that the named pipe created for signalling the exit code is not inheritable
R=ager@google.com
Review URL: http://codereview.chromium.org//8267006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@396 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-13 13:34:36 +00:00
sgjesse@google.com d0496ec807 Implement the full process interface for Windows
There are still a couple of TODOs in the code.

R=ager@google.com
Review URL: http://codereview.chromium.org//8249007

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@389 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-13 10:38:37 +00:00
sgjesse@google.com d5e6daf99f Fix Windows build
TBR=ager@google.com

BUG=
TEST=

Review URL: http://codereview.chromium.org//8233008

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@326 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-11 11:45:17 +00:00
dgrove@google.com 4c0f559d23 Initial checkin.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@15 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-05 05:20:07 +00:00