TelluIoT / ThingML

The ThingML modelling language
https://github.com/TelluIoT/ThingML
Apache License 2.0
101 stars 32 forks source link

JavaScript TTY plugin requires the process to run inside an actual TTY #235

Closed piernov closed 5 years ago

piernov commented 5 years ago

In f64b280aa841c3cc025d237c588e154f4ab6022c the TTY plugin for JavaScript was made to require an actual TTY. (checking process.*.isTTY) This prevents use outside shell, for example calling from a NodeJS application using child_process.fork() and then redirecting input/ouput streams to exchange message with the ThingML process or between multiple ThingML processes.

Any reason a TTY would be needed? If not, could this be reverted?

Thanks,

brice-morin commented 5 years ago

A key use case for the TTY plugin is for debugging purpose, together with the JSON serialization plugin, where the user would type some JSON payloads in the terminal. I would not use the TTY plugins in a more advanced way.

piernov commented 5 years ago

What would be the preferred way for IPC, or for integrating with NodeJS?

brice-morin commented 5 years ago

Well, if two things implemented in ThingML are running locally on the same node (in the same ThingML configuration), there is no need for using external connectors and protocols (just normal connectors). Otherwise, the UDP or Websocket plugins could be used. But I must confess we have not used them for a while, so it might be some bug fixing to be done there.