doc: fixes for spawn.with_line_callback

This commit is contained in:
Daniel Hahler 2015-12-26 18:45:34 +01:00
parent 5db280ab73
commit df21a85a9a
1 changed files with 16 additions and 14 deletions

View File

@ -129,21 +129,23 @@ function spawn.with_shell(cmd)
end end
end end
--- Spawn a program and asynchronously and capture its output line by line. --- Spawn a program and asynchronously capture its output line by line.
-- @tparam string|table cmd The command. -- @tparam string|table cmd The command.
-- @tab callbacks Table containing callbacks that should be -- @tab callbacks Table containing callbacks that should be invoked on
-- invoked on various conditions. -- various conditions.
-- @tparam[opt] function callbacks.stdout Function that is called with each line of -- @tparam[opt] function callbacks.stdout Function that is called with each
-- output on stdout, e.g. `stdout(line)`. -- line of output on stdout, e.g. `stdout(line)`.
-- @tparam[opt] function callbacks.stderr Function that is called with each line of -- @tparam[opt] function callbacks.stderr Function that is called with each
-- output on stderr, e.g. `stderr(line)`. -- line of output on stderr, e.g. `stderr(line)`.
-- @tparam[opt] function callbacks.output_done Function to call when no more output -- @tparam[opt] function callbacks.output_done Function to call when no more
-- is produced. -- output is produced.
-- @tparam[opt] function callbacks.exit Function to call when the spawned process -- @tparam[opt] function callbacks.exit Function to call when the spawned
-- exits. This function gets the exit reason and code as its argument. The -- process exits. This function gets the exit reason and code as its
-- reason can be "exit" or "signal". For "exit", the second argument is the exit -- arguments.
-- code. For "signal", the second argument is the signal causing process -- The reason can be "exit" or "signal".
-- termination. -- For "exit", the second argument is the exit code.
-- For "signal", the second argument is the signal causing process
-- termination.
-- @treturn[1] Integer the PID of the forked process. -- @treturn[1] Integer the PID of the forked process.
-- @treturn[2] string Error message. -- @treturn[2] string Error message.
function spawn.with_line_callback(cmd, callbacks) function spawn.with_line_callback(cmd, callbacks)