(core) communicate with sandbox via standard pipes

Summary:
This switches to using stdin/stdout for RPC calls to the sandbox, rather than specially allocated side channels. Plain text error information remains on stderr.

The motivation for the change is to simplify use of sandboxes, some of which support extra file descriptors and some of which don't.

The new style of communication is made the default, but I'm not committed to this, just that it be easy to switch to if needed. It is possible I'll need to switch the communication method again in the near future.

One reason not to make this default would be windows support, which is likely broken since stdin/stdout are by default in text mode.

Test Plan: existing tests pass

Reviewers: dsagal, alexmojaki

Reviewed By: dsagal, alexmojaki

Differential Revision: https://phab.getgrist.com/D2897
This commit is contained in:
Paul Fitzpatrick
2021-07-08 17:52:00 -04:00
parent 2f900f68f8
commit 4222f1ed32
3 changed files with 62 additions and 20 deletions

View File

@@ -13,7 +13,7 @@ import six
from acl_formula import parse_acl_formula
import actions
from sandbox import Sandbox
from sandbox import get_default_sandbox
import engine
import migrations
import schema
@@ -115,8 +115,7 @@ def run(sandbox):
sandbox.run()
def main():
sandbox = Sandbox.connected_to_js_pipes()
run(sandbox)
run(get_default_sandbox())
if __name__ == "__main__":
main()