Closed piranna closed 9 years ago
We can make process return JavaScript Promise object.
I totally support the idea of using Promises as a core part of the kernel. I'd suggest that native v8 promises are used or at least ones that follow the official spec.
Process returning a promise of their exit status seems to be a cool idea :-) Could they be used to return a value when the promise is not rejected? How? In what circunstancies?
Well, the exit could be either a success or failure, so you can probably resolve the process if it ends without error, and reject it if there was an error.
Isolates are temporary not supported to reduce project complexity.
(Another thing that maybe comes here, or it's userspace)
Poxis systems allow to set a status variable to show if the command exited correctly or not, being this a char integer where zero is "all was right". On the other hand, Plan9 expand this allowing to set a string instead up to 255 bytes length where the "all was right" value is done by setting it to null. This later one allow to set messages easier to interpret by a human instead of by another program, specially when programmers are not using correctly the exit status variable to show a code for each error and only return '1' as oposition to zero - "all was right".
We can do better: based on Plan9 way, we can set the exit status to be an Error object, where the error message field would be the same as the error message intended on Plan9, but also this Error object can have a code field "a-la" Poxis but it can have other interesting fields like the stack-trace, specially when the process exits due to unhandled exceptions (and the exit status field it's the exception itself :-) ).
Comments? Suggestions?