[erlang-questions] Issues with stdin on ports

Anthony Grimes i@REDACTED
Mon Jul 29 19:54:07 CEST 2013


Right, there are certainly ways around it, but the point of this
discussion is that it seems to be a missing piece of functionality that
Erlangers cannot do unless they write C code. It seems like ports are
90% of the way there. I think Mr. Hedeland represented my points nicely.

-Anthony

> Robert Raschke <mailto:rtrlists@REDACTED>
> July 29, 2013 4:16 AM
> Hi Anthony,
>
> could Py-interface http://www.lysator.liu.se/~tab/erlang/py_interface/
> <http://www.lysator.liu.se/%7Etab/erlang/py_interface/> help with that?
>
> Note, I've not used it, so don't know much at all beyond reading that
> page. It would probably mean using the Pygments library, rather than
> going via the command line pygmentize. You can probably take the
> pygmentize source and replace the command line handling with setting
> up a Python Node.
>
> Alternatively, and not necessarily very nice, instead of streaming to
> pygmentize, write to a file and invoke on that. You wouldn't even need
> a port then, you could get away with os:cmd/1 (if you aren't
> interested in return codes). But you already know this, I think.
>
> Robby
>
> PS Something like expect for Erlang ports would be pretty cool,
> though. Not that I'm not volunteering ;-)
>
>
>
>
> Anthony Grimes <mailto:i@REDACTED>
> July 29, 2013 2:19 AM
> Hey Robert.
>
> I don't think C nodes help in this case, and they don't solve the
> general problem. One of my use cases is talking to pygmentize, which
> is a Python program. If I want to do that, I have to write a middleman
> program that does the actual communication with this program and talks
> to my Erlang program over a socket, or via ports if I make the
> middleman program look for some specific sequence of bytes to treat as
> EOF since I can't send actual EOF.
>
>
>
> Robert Raschke <mailto:rtrlists@REDACTED>
> July 29, 2013 2:12 AM
>
> Hi Anthony,
>
> In the past, I've tended to use the port mechanism to simply kick off
> a C node, which then allows you to have full control over whatever
> communications needs you have.
>
> This obviously only works if you are interfacing with a technology
> that will allow you to create C node and use the EI libs in some way.
> Not sure if that is the case from what you wrote.
>
> Regards,
> Robby
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130729/12432d39/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: compose-unknown-contact.jpg
Type: image/jpeg
Size: 770 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130729/12432d39/attachment.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: postbox-contact.jpg
Type: image/jpeg
Size: 1188 bytes
Desc: not available
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130729/12432d39/attachment-0001.jpg>


More information about the erlang-questions mailing list