How to execute an external CLI program

I’m writing a CLI program that makes service requests, transform data, and print letters to printer.
My plan is to consume Foxit Reader CLI tool in my Purescript but I’m not sure how to execute *.exe applications and pass arguments.

For this kind of work you’re going to want to use libraries from the purescript-node organization. Then you can search for Node solutions to your problems, and then use the relevant binding.

For example, in this case I think you’ll want to use exec or execFile to execute a *.exe application and pass arguments. That’s part of the child process API in Node, which is supplied in PureScript by the node-child-process library:

I did a quick search for how to do this in Node and found this answer:

which could be easily converted to use the PureScript Node bindings.

1 Like