| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 return accumulator; | 363 return accumulator; |
| 364 } | 364 } |
| 365 | 365 |
| 366 | 366 |
| 367 // Modern Linux has the waitid call, which is like waitpid, but more useful | 367 // Modern Linux has the waitid call, which is like waitpid, but more useful |
| 368 // if you want a timeout. If we don't have waitid we can't limit the time | 368 // if you want a timeout. If we don't have waitid we can't limit the time |
| 369 // waiting for the process to exit without losing the information about | 369 // waiting for the process to exit without losing the information about |
| 370 // whether it exited normally. In the common case this doesn't matter because | 370 // whether it exited normally. In the common case this doesn't matter because |
| 371 // we don't get here before the child has closed stdout and most programs don't | 371 // we don't get here before the child has closed stdout and most programs don't |
| 372 // do that before they exit. | 372 // do that before they exit. |
| 373 #if defined(WNOWAIT) && !defined(ANDROID) | 373 // |
| 374 // We're disabling usage of waitid in Mac OS X because it doens't work for us: |
| 375 // a parent process hangs on waiting while a child process is already a zombie. |
| 376 // See http://code.google.com/p/v8/issues/detail?id=401. |
| 377 #if defined(WNOWAIT) && !defined(ANDROID) && !defined(__APPLE__) |
| 374 #define HAS_WAITID 1 | 378 #define HAS_WAITID 1 |
| 375 #endif | 379 #endif |
| 376 | 380 |
| 377 | 381 |
| 378 // Get exit status of child. | 382 // Get exit status of child. |
| 379 static bool WaitForChild(int pid, | 383 static bool WaitForChild(int pid, |
| 380 ZombieProtector& child_waiter, | 384 ZombieProtector& child_waiter, |
| 381 struct timeval& start_time, | 385 struct timeval& start_time, |
| 382 int read_timeout, | 386 int read_timeout, |
| 383 int total_timeout) { | 387 int total_timeout) { |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 void Shell::AddOSMethods(Handle<ObjectTemplate> os_templ) { | 666 void Shell::AddOSMethods(Handle<ObjectTemplate> os_templ) { |
| 663 os_templ->Set(String::New("system"), FunctionTemplate::New(System)); | 667 os_templ->Set(String::New("system"), FunctionTemplate::New(System)); |
| 664 os_templ->Set(String::New("chdir"), FunctionTemplate::New(ChangeDirectory)); | 668 os_templ->Set(String::New("chdir"), FunctionTemplate::New(ChangeDirectory)); |
| 665 os_templ->Set(String::New("setenv"), FunctionTemplate::New(SetEnvironment)); | 669 os_templ->Set(String::New("setenv"), FunctionTemplate::New(SetEnvironment)); |
| 666 os_templ->Set(String::New("umask"), FunctionTemplate::New(SetUMask)); | 670 os_templ->Set(String::New("umask"), FunctionTemplate::New(SetUMask)); |
| 667 os_templ->Set(String::New("mkdirp"), FunctionTemplate::New(MakeDirectory)); | 671 os_templ->Set(String::New("mkdirp"), FunctionTemplate::New(MakeDirectory)); |
| 668 os_templ->Set(String::New("rmdir"), FunctionTemplate::New(RemoveDirectory)); | 672 os_templ->Set(String::New("rmdir"), FunctionTemplate::New(RemoveDirectory)); |
| 669 } | 673 } |
| 670 | 674 |
| 671 } // namespace v8 | 675 } // namespace v8 |
| OLD | NEW |