Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy doesn't work, while executing jail_code there is no output displayed #109

Open
antoineFrau opened this issue Dec 18, 2020 · 0 comments

Comments

@antoineFrau
Copy link

antoineFrau commented Dec 18, 2020

Hello,
I would like to execute this python code (containing a print statement and a sleep call for 1 second for each iteration of the range(5)).

The idea was to test and see if PROXY is working as desired. I was excepting to see while executing jail_code.jail_code(...) in the stdout of my terminal progressively displayed the numbers second by second:

1
2
3
4
full-output
- 0
- 1
- 2
- 3
- 4

but didn't happened..
First one should be the output printed by the proxy, and the second one is when I iterate on the result object stdout.

from codejail import jail_code
jail_code.set_limit("REALTIME", 20)
jail_code.set_limit("CPU", 100)
jail_code.set_limit("FSIZE", 10000)
jail_code.set_limit("PROXY", 1)

code = """
import time
for i in range(5):
    print(i)
    time.sleep(1)
"""

res = jail_code.jail_code(
    "python",
    code
)
print("full-output")
for line in res.stdout.decode('utf-8').split('\n'):
    print("-", line)

The issue here is that during this execution of jail_code.jail_code(...) the PROXY didn't seems to print anything in the output is that normal, I'm missing something ?
Thanks in advance.
PS: I have CODEJAIL_TEST_USER/ENV and CODEJAIL_PROXY configured in my ENV.

@antoineFrau antoineFrau changed the title Proxy doesn't work, it wait until the end of execution before printing the output Proxy doesn't work, while executing jail_code there is no output displayed Dec 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant