Newbie questions

Hello all,
I just started using train and I have a couple of questions:

  • When using , is it possible to let the command display the standard output?
  • how can be the script terminated without errors? Using “return” in the main body is not allowed!

btw, it would be nice to have folder.remove to directly remove readonly files too! At the moment I ended up using folder.setAttributes and then folder.remove , but it’s twice as slower on big folders. Not a problem anyway…

Thank you for this great tool!

By default it only logs it as “info”, you can also set a capture function in the execute parameters so you get a callback every time there’s a line of output (and you could log that too)

Just let it end, or wrap everything in a function and call that in the main method (At the end), the return value will always be 0 unless an exception esacpes.

1 Like

Hello ck, thank you for the hints!
I tryed to pass “-m” command line switch to show the information messages but when using shell.system nothing is displayed .
The command launched in shell.system is a .bat file that calls an msbuild script (until I’ll convert to train these too)
It seems that shell.system doesn’t allow capturing, is it correct?

It has a few options, one is a callback for capturing, the other is capturing the output in a string. If you pass capture: true as an extra argument it will return the result. If you pass:

capture: function(a) { log(a); }

you should get output as it does it.

ok, I will use shell.exec which has the capture options, shell.system doesn’t!