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

Is there an option to specify run command with glot-run API? #2

Closed
artemskikh opened this issue Feb 1, 2016 · 3 comments
Closed

Is there an option to specify run command with glot-run API? #2

artemskikh opened this issue Feb 1, 2016 · 3 comments

Comments

@artemskikh
Copy link

Sorry, I see that it's available on the website, but couldn't find any real API examples. Is it a thing (specifying custom run command)?

@artemskikh
Copy link
Author

  • one more question: can the files array (in JSON request) contain a simple text file that is (not compiled, obviously) then used as a param in the run command?
    Basically, I'm looking for a way of running/testing the program with different input.

@prasmussen
Copy link
Member

You can specify a custom run command with the command attribute.
And yes you can send in arbitrary text files. I made an example python snippet which reads a text file from stdin here: https://glot.io/snippets/ebj1rtktlt.

The api payload looks like this:

{
  "files": [
    {
      "name": "foo.py",
      "content": "import sys\n\nfor line in sys.stdin:\n    print(line.rstrip())"
    },
    {
      "name": "input.txt",
      "content": "1\n2\n3"
    }
  ],
  "command": "cat input.txt | python foo.py"
}

@artemskikh
Copy link
Author

Thanks so much, exactly what I was looking for! Keep up the good work!

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

2 participants