I am trying to develop a plugin.
It is aimed at competitive programming audience to help them in their contests.
Briefly, It does the following:
Goes to the contest website ( Using the given user input as URL inside the plugin ) and downloads the page code.
Then It parses the downloaded HTML code and breaks it into useful parts. Like problem statement, time and memory
limits, test cases etc.
Then It creates a source file (in some language) with filename mapped with the parsed problem and opens a new tab inside that workspace so that user can start writing his solution there.
All that happens with a single ‘Go’ click inside the plugin.
Now as a next step,
- I have provided a ‘Run’ button which the user will click when he wants to test his solution.
For testing :
- The parsed test cases will be given as inputs to the program and the outputs will be matched with the expected outputs.
- Based on this the verdict could be given to the solution.
- Also the time taken to execute the instance and maximum memory used are also to be calculated.
And this is the part where I am kind of stuck.
I want to know how can achieve this inside my plugin.
I was using ‘child_process’ module but it is not working. ( Since the instance will take inputs from stdin. I tried to give inputs from file using ‘<’ but it is not working)
So to summarize :
How can I run any command and get the execution details from my plugin in the backend and process the results to generate a verdict?
I use windows 10.
And I wish the solution to be os independent