command


Description:

[ Version ( since = "1.9.1" ) ]
public string command (string[] arguments) throws Error

run a command from the guest filesystem

This call runs a command from the guest filesystem. The filesystem must be mounted, and must contain a compatible operating system (ie. something Linux, with the same or compatible processor architecture).

The single parameter is an argv-style list of arguments. The first element is the name of the program to run. Subsequent elements are parameters. The list must be non-empty (ie. must contain a program name). Note that the command runs directly, and is *not* invoked via the shell (see sh).

The return value is anything printed to *stdout* by the command.

If the command returns a non-zero exit status, then this function returns an error message. The error message string is the content of *stderr* from the command.

The $PATH environment variable will contain at least /usr/bin and /bin. If you require a program from another location, you should provide the full path in the first parameter.

Shared libraries and data files required by the program must be available on filesystems which are mounted in the correct places. It is the caller’s responsibility to ensure all filesystems that are needed are mounted at the right locations.

Parameters:

this

A GuestfsSession object

arguments

an array of strings

Returns:

the returned string, or NULL on error