Unit 'amigados' Package
[Overview][Constants][Types][Procedures and functions][Index] [#aros]

RunCommand

Runs a program using the current process

Declaration

Source position: amigados.pas line 2284

function RunCommand(

  SegList: Pointer;

  StackSize: LongWord;

  const ArgPtr: PChar;

  ArgSize: LongWord

):LongInt;

Arguments

SegList

  

Seglist of command to run.

StackSize

  

Number of bytes to allocate for stack space

ArgPtr

  

Pointer to argument command string.

ArgSize

  

Number of bytes in argument command string.

Function result

Return code from executed command. -1 indicates failure

Description

Runs a command on your process/cli. Seg may be any language, including BCPL programs. Stack is in bytes. paramptr is a null- terminated string, paramlen is its length. Returns the returncode the program exited. Returns -1 if the stack couldn't be allocated.

NOTE: the argument string must be terminated with a newline to work properly with ReadArgs() and other argument parsers.

RunCommand also takes care of setting up the current input filehandle in such a way that ReadArgs() can be used in the program, and restores the state of the buffering before returning. It also sets the value returned by GetArgStr(), and restores it before returning.

It's usually appropriate to set the command name (via SetProgramName()) before calling RunCommand(). RunCommand() sets the value returned by GetArgStr() while the command is running.

See also

CreateNewProc

  

Create a new process from taglist

SystemTagList

  

Have a shell execute a command line

Execute

  

Execute a CLI command

GetArgStr

  

Returns the arguments for the process

SetProgramName

  

Sets the name of the program being run

ReadArgs

  

Read bytes of data from a file


Documentation generated on: 2021-07-30