kustermann@google.com
c20c523de8
Set close-on-exec flag on pipe() and epoll() file descriptors
...
Review URL: https://codereview.chromium.org//11644017
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@16308 260f80e4-7a28-3924-810f-c04153c831b5
2012-12-19 09:36:47 +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
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
rnystrom@google.com
908b045578
Look up executable on PATH when given environment variables.
...
Fixes http://code.google.com/p/dart/issues/detail?id=4402
Review URL: https://codereview.chromium.org//11260048
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@14300 260f80e4-7a28-3924-810f-c04153c831b5
2012-10-30 18:17:51 +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
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
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
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
sgjesse@google.com
42b70dcddb
Change the thread interface in runtime/platform and use it starting all threads
...
The platform thread interface (dart::thread) is now refactored to an
all static interface as suggested by iposva@ and asiva@. Use this
interface for running all threads in the VM.
R=ager@google.com , iposva@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9141005
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3830 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-02 08:59:26 +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
37af08b705
Move actual work out of the SIGCHLD signal handler for the dart:io
...
process library.
Use the self-pipe trick to signal a dedicated thread when a SIGCHLD
signal is received. The dedicated thread will perform the actual work
of extracting the exit code and posting it back to Dart.
R=sgjesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9293030
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3711 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-31 09:10:24 +00:00
ager@google.com
c3f89c46ec
Fix race condition between signal handler and main thread.
...
The signal handler could unblock the main thread. The main thread
could delete the Process object the signal handler is holding a
pointer to. The signal handler could then close a file descriptor
it got from the deleted memory.
The whole process exit handling infrastructure is pretty fragile.
We should attempt to come up with something simpler.
R=sgjesse@google.com
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9225019
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3652 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-27 13:01:16 +00:00
ager@google.com
0e53275c79
Save and restore errno in signal handler.
...
Having a signal handler that clobbers errno can lead to spurious
behavior in other code that relies on errno. One example of this
is pthread_cond_wait.
BUG=
TEST=
Review URL: https://chromiumcodereview.appspot.com//9193014
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3499 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-23 15:07:09 +00:00
sgjesse@google.com
0122a33a76
Handle EINTR on all IO operations
...
There have been spurious FileIOExceptions seen on some Mac OS machines.
R=ager@google.com ,whesse@google.com
BUG=
TEST=
Review URL: http://codereview.chromium.org//9139011
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3185 260f80e4-7a28-3924-810f-c04153c831b5
2012-01-11 15:12:27 +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
ager@google.com
946b015d0a
Fix memory leak in MacOS process handling.
...
Report error for failing writes. We used to enter a poll loop
because we kept on attempting to write.
Currently the error handling in the socket interface is inconsistent.
We have a big TODO item on general error handling including the socket
interface.
R=sgjesse@google.com
BUG=
TEST=
Review URL: http://codereview.chromium.org//8659032
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1887 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-29 10:10:07 +00:00
sgjesse@google.com
d7c8c1f1e4
Fix a number of issues with the process handling
...
1. Ignore the signal SIGPIPE on Linux and Mac OS
When reading from or writing to a closed pipe the signal SIGPIPE
is raised. The default handling of this is to terminate the
program. When signal SIGPIPE is ignored the read and write
returns EPIPE.
2. Wrong return type for stdio getter
3. When there is an error on a socket mark it as closed
4. Mark the pipe used for process exit status as a one way pipe
5. Add tests to test stdin, stdout and stderr in Dart scripts
R=ager@google.com
BUG=dart:536, dart:454
TEST=
Review URL: http://codereview.chromium.org//8662006
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1793 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-23 14:49:18 +00:00
iposva@google.com
0c9902ca67
- Avoid allocating variable length arrays on the stack.
...
- Fix C++ warning about copying vtables.
- Use correct delete for PortMap entries.
Review URL: http://codereview.chromium.org//8555024
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1538 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-15 17:47:21 +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
ager@google.com
c7125db824
Simplify SIGCLD handler on linux and mac.
...
Handle all dead processes on sigal. This avoids hanging because we
missed some process terminations when they happened simultaneously.
R=sgjesse@google.com
BUG=
TEST=
Review URL: http://codereview.chromium.org//8506010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1354 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-09 13:35:14 +00:00
ager@google.com
ddc5446aa7
Avoid creating zombie processes by waiting for the terminated process.
...
R=sgjesse@google.com
BUG=
TEST=
Review URL: http://codereview.chromium.org//8506009
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@1347 260f80e4-7a28-3924-810f-c04153c831b5
2011-11-09 12:05:44 +00:00
ager@google.com
86284155b9
Improve error handling in the process library.
...
Verify that the arguments have the types expected by the
implementation. Require a List instance containing builtin
Strings as the arguments. Require a builtin String path.
R=sgjesse@google.com
BUG=
TEST=
Review URL: http://codereview.chromium.org//8383037
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@690 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-25 12:16:04 +00:00
sgjesse@google.com
b7485553a2
Fix deadlock in process exit handling
...
As glibc allocation routines are not re-entrant avoid calling delete in signal handler.
Instead the message send from the signal handler on process exit contains both the pid and the exit code. The internal _Process object always installs a data handler for the exit message and calls back into C++ to cleanup the resources allocated for running a process.
Changed the ActiveProcess (renamed to ProcessInfo) to form an explicitly linked list.
R=ager@google.com
BUG=dart:1
TEST=
Review URL: http://codereview.chromium.org//8227010
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@325 260f80e4-7a28-3924-810f-c04153c831b5
2011-10-11 11:26:12 +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