Running another host os program inside the plugin?


Hello Everyone!
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:

  1. Goes to the contest website ( Using the given user input as URL inside the plugin ) and downloads the page code.

  2. Then It parses the downloaded HTML code and breaks it into useful parts. Like problem statement, time and memory
    limits, test cases etc.

  3. 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.

  4. All that happens with a single ‘Go’ click inside the plugin.

Now as a next step,

  1. I have provided a ‘Run’ button which the user will click when he wants to test his solution.

For testing :

  1. The parsed test cases will be given as inputs to the program and the outputs will be matched with the expected outputs.
  2. Based on this the verdict could be given to the solution.
  3. 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 :no_mouth::zipper_mouth_face:


You might look at some of the IDE packages - several run processes in the background. Linters are also probably good examples.