External start



   external_start() - execute a shell command external to the driver


   int external_start(int, string | string *, string | function, string | function, string | function | void);


   If PACKAGE_EXTERNAL is defined, then lines of the form:

       external_cmd_1: /usr/local/bin/gzip

   in the config file allow the mud to run the command using the following efun:

       int external_start(int which, string args, mixed read_cb, mixed write_cb, mixed close_cb)

   which is the command number (e.g. 1 from the example above) args is the argument passed to the command.  A socket is returned, which can be used to communicate with stdin/stdout of the command.

   valid_socket() is passed "external" as the operation.
   Execute a shell command external to the driver. 

   Commands that you would like to execute must be added to the runtime config. The enumerated commands may then be invoked by their number as the first argument to external_start `external_index`. 

   This function returns the socket number which you should record for later processing of the results from the external command.
   `args` - An array of the arguments passed to the external command.
   `read_call_back` - As data becomes available, this function will be called with a string containing that data.
   `write_call_back` - I am not 100% sure what would be written to the external command, but, this is a required parameter.
   `close_call_back` - When the socket closes, this function is called.


   You can configure your runtime configuration to know about various external commands by adding lines such as: external_cmd_## : /path/to/command 
   where ## is the number that will be invoked with `external_start`.

       # external commands
       external_cmd_1 : /usr/local/bin/node
       external_cmd_2 : /usr/bin/curl


   The callbacks, when invoked, will pass the following information:

       void read_call_back(int fd, string data)
       void write_call_back(int fd)
       void close_call_back(int fd)


   提示:fluffos v2019支持100个外部命令,使用示例:https://bbs.mud.ren/threads/244