Aaron Piotrowski
66ca530f0d
Move static parallel extension properties into internal class
2019-04-29 10:19:32 -05:00
Aaron Piotrowski
d6e7fed763
Explicit casts for event name
2019-04-24 10:42:45 -05:00
Aaron Piotrowski
b6acc4f386
Update for latest parallel extension changes
2019-04-24 10:05:42 -05:00
Aaron Piotrowski
740696275c
Add a couple tests and ignore some blocks only executed in threads
2019-03-08 13:37:52 -06:00
Aaron Piotrowski
c1f6b62799
Check if watcher has already been cancelled
...
This seems to only happen in 7.1 for some reason… will perhaps need to dig further into why.
2019-03-08 11:26:48 -06:00
Aaron Piotrowski
2191d1145b
Cancel watcher if no threads remain
2019-03-08 11:20:47 -06:00
Aaron Piotrowski
738f50afe7
Define AMP_CONTEXT_ID in contexts
...
Uses PID in processes or a sequential ID for threads.
2019-02-20 17:31:22 -06:00
Aaron Piotrowski
a0575b4930
Fix handling of invalid connections
...
Channel::receive() can throw ChannelException and SerializationException, so just catch everything here.
2019-02-18 18:44:30 -06:00
Aaron Piotrowski
a9e22e9ef8
Add getId() method; don't dup futures array
2019-02-18 18:43:11 -06:00
Aaron Piotrowski
b8b73cdea3
Use Future::select()
2019-02-18 13:05:43 -06:00
Aaron Piotrowski
36d3a3d963
Periodically check Future to see if thread crashed
2019-02-18 11:48:13 -06:00
Aaron Piotrowski
7fca17d7ef
Explicitly close channel when thread finishes
2019-02-18 10:32:16 -06:00
Aaron Piotrowski
8e19da949f
Remove unused imports
2019-02-18 09:43:14 -06:00
Aaron Piotrowski
f919371aee
Don't swallow SynchronizationError in ContextException
2019-02-18 09:38:42 -06:00
Aaron Piotrowski
f2e5224856
Unite Process and Parallel context interfaces
...
Allows scripts to be written for either context.
2019-02-17 23:50:41 -06:00
Aaron Piotrowski
c55f34c551
Update for krakjoe/parallel interrupt branch
...
Dumped the signal socket.
2019-02-15 18:25:29 -06:00
Aaron Piotrowski
638a1bb638
Implement thread killing
...
Will not interrupt blocking calls such as sleep, but in practice this shouldn't be much of a problem.
2019-02-14 18:12:51 -06:00
Aaron Piotrowski
c60fc63cb6
Add timer in parallel context for kill breakpoint
2019-02-14 01:10:40 -06:00
Aaron Piotrowski
2d35051391
Update for krakjoe/parallel changes
2019-02-14 00:56:27 -06:00
Aaron Piotrowski
410c88e859
Serialize function arguments
...
Maybe this is a horrible idea, but we serialize everything else, so why not?
2019-02-14 00:34:45 -06:00
Aaron Piotrowski
ecaf0a854b
Add support for krakjoe/parallel
2019-02-14 00:34:45 -06:00
Aaron Piotrowski
c77843fa77
Catch parse error and provide better error message
2019-02-13 16:36:45 -06:00
Aaron Piotrowski
6b6e38cf70
Define constants in contexts for easy identification
2019-02-13 14:15:16 -06:00
Aaron Piotrowski
80c07011d6
Fix failing Process::join()
...
If the process is killed while joining, an exception was thrown from Process::kill().
2019-01-09 10:25:30 -06:00
Aaron Piotrowski
beafcdb140
Close channel in process when ended
...
Also restored destructor to DefaultPool to immediately kill workers instead of waiting until the end of the process.
2019-01-09 09:28:31 -06:00
Aaron Piotrowski
dc036dfa33
Use Promise\wait() in process-runner.php
2019-01-04 16:58:05 -06:00
Aaron Piotrowski
65d71c3526
Check for resolution of promise in process-runner.php
2019-01-04 16:46:53 -06:00
Aaron Piotrowski
f391d3549a
Improve error message when parent has exited
2018-12-30 13:08:38 -06:00
Pieter Hordijk
354e64db09
Fixed typo in exception message
...
When the process cannot be started it tells me "Staring the process failed".
You can stare at a process all you want, but it should be "Starting".
2018-11-08 14:29:35 -06:00
Aaron Piotrowski
596f41886b
Return PID from Process::start()
2018-11-04 11:34:18 -06:00
Aaron Piotrowski
87d728ea35
Fix argument order
...
Oddly PhpStorm didn't highlight this as wrong.
2018-10-24 22:35:27 -05:00
Aaron Piotrowski
fe293c09bb
Improve process communication error handling
2018-10-23 22:14:51 -05:00
Aaron Piotrowski
3c0baa4e43
Remove catch of ChannelException
...
This catch block may hide errors that the user makes. If the parent died, another exception will be generated and caught below when trying to send the ExitFailure object.
2018-10-23 21:28:24 -05:00
Aaron Piotrowski
fd6c531d87
Add eof check on STDIN
2018-10-23 21:26:26 -05:00
Aaron Piotrowski
f1b0a59b86
Final all the things!
2018-10-21 10:54:46 -05:00
Aaron Piotrowski
0d85b5a149
supported() → isSupported()
2018-10-21 10:34:32 -05:00
Aaron Piotrowski
e72a50dc8d
Upgrade to latest amphp/process release
...
STDOUT and STDERR of a child process is no longer automatically piped to STDOUT and STDERR of the parent. Instead these streams are available on Context\Process for the user to determine how they should be handled.
2018-10-21 10:25:29 -05:00
Aaron Piotrowski
cb2aa9c59c
Use 127.0.0.1 instead of localhost
...
Avoids DNS lookup issues on Windows.
2018-10-21 10:09:28 -05:00
Aaron Piotrowski
8d60fdbb64
Trigger error in process runner before exiting
2018-10-21 10:03:26 -05:00
Aaron Piotrowski
bf08e2fdf4
Remove output buffering in child process; update require scoping
2018-10-15 00:15:56 -05:00
Aaron Piotrowski
fa864692e7
Read key in chunks
...
Not entirely sure if this is necessary given the expected length, but it doesn't hurt either.
2018-10-11 18:11:02 -05:00
Aaron Piotrowski
9db273d484
Unset key if process connect times out; update docblocks
2018-10-11 11:14:14 -05:00
Aaron Piotrowski
4cf26d4dfb
Authenticate worker when connecting to IPC
2018-10-10 18:31:34 -05:00
Aaron Piotrowski
9e40d3aa0c
Use TCP for IPC on Windows
2018-10-09 09:12:23 -05:00
Aaron Piotrowski
b654463339
Fix code style
2018-10-07 09:50:45 -05:00
Aaron Piotrowski
cb5ea736d4
Improve process IPC
...
Processes now use a shared server socket instead of stdin and stdout for IPC.
2018-10-07 09:31:35 -05:00
Niklas Keller
7326946884
Symlink PHARs if they don't have a .phar extension
2018-03-21 15:37:51 +01:00
Niklas Keller
c1114188b6
Improve error messages
2018-03-21 13:49:52 +01:00
Aaron Piotrowski
ed3662172d
Added signal() and getPid() methods to Process
2018-03-14 18:51:13 -05:00
Chris Wright
11a3e27db5
Escape script path in Process command ( #38 )
2018-01-31 18:31:36 +01:00