open_port/2 overloading

Vance Shipley vances@REDACTED
Wed Aug 20 23:16:29 CEST 2003


It is unfortunate that the open_port/2 BIF is overloaded to
handle drivers.  The result is that opening a port always
succeeds:

Erlang (BEAM) emulator version 5.3 [source] [hipe]

Eshell V5.3  (abort with ^G)
1> P = open_port({spawn, 'bogus_drv'}, []).
sh: bogus_drv: not found
                        #Port<0.28>
2> is_port(P).
true

This is because if there is no currently loaded driver with
the name "bogus_drv" it will start a Unix shell to run the
command "bogus_drv".  The shell get's started therefore we
get an opened port.

It would be nice to have an explicit method to open ports on
drivers which would fail appropriately.

	-Vance



More information about the erlang-questions mailing list