0

When I execute a script with Node.js in command prompt lets say like that :

c:\> node a_script.js 

It just exits when the script is ended which is boring because I d'like to test some variables values. I can't find any option using node --help to avoid that, do you know a way ?

I want to do a Sublime Text Build System

{
    "cmd": ["start", "cmd", "/k", "C:/progra~2/nodejs/node.exe", "$file"],
    "selector": "source.js",
    "shell" : true
}

My script is executed but it exit just after. I expect to go back to REPL but node.exe closes once it has executed my script.

The solutions provided by the following question didn't worked : How do I load my script into the node.js REPL? since most of the time it implies to type some command in the REPL

I also tried to use --interactive but no luck.

snoob dogg
  • 2,491
  • 3
  • 31
  • 54
  • 1. Run node. 2. Type `.load a_script.js` 3. Do whatever else you want at the REPL. – Brandin Apr 09 '18 at 19:13
  • See also https://stackoverflow.com/questions/8425102/how-do-i-load-my-script-into-the-node-js-repl – Brandin Apr 09 '18 at 19:13
  • in fact, and to be more precise, I avoided to explain that I wanted to do a build system for Sublime text but I will edit my question because it has sens now – snoob dogg Apr 09 '18 at 19:15
  • It was at the time of my vote. Now it isn't, but the other question is still at least relevant. – Kevin B Apr 09 '18 at 22:07

1 Answers1

0

I solved my problem by installing replpad with npm

npm install -g replpad 

And using the following build system :

{
    "shell" : true, 
    "cmd": ["start", "cmd", "/k", "replpad", "$file_path"], 
}

that's a bit weird is that I need to save the file once replpad has been loaded but it works

snoob dogg
  • 2,491
  • 3
  • 31
  • 54