Next: , Up: Miscellaneous operations   [Contents][Index]


7.7.1 Running other Programs

GPGME features an internal subsystem to run the actual backend engines. Along with data abstraction object this subsystem can be used to run arbitrary simple programs which even need not be related to cryptographic features. It may for example be used to run tools which are part of the GnuPG system but are not directly accessible with the GPGME API.

Function: gpgme_error_t gpgme_op_spawn (gpgme_ctx_t ctx, const char *file, const char *argv[], gpgme_data_t datain, gpgme_data_t dataout, gpgme_data_t dataerr, unsigned int flags)

SINCE: 1.5.0

The function gpgme_op_spawn runs the program file with the arguments taken from the NULL terminated array argv. If no arguments are required argv may be given as NULL. In the latter case or if argv[0] is the empty string, GPGME uses the basename of file for argv[0]. The file descriptors stdin, stdout, and stderr are connected to the data objects datain, dataout, and dataerr. If NULL is passed for one of these data objects the corresponding file descriptor is connected to /dev/null.

The value in flags is a bitwise-or combination of one or multiple of the following bit values:

GPGME_SPAWN_DETACHED

SINCE: 1.5.0

Under Windows this flag inhibits the allocation of a new console for the program. This is useful for a GUI application which needs to call a command line helper tool.

GPGME_SPAWN_ALLOW_SET_FG

SINCE: 1.5.0

Under Windows this flag allows the called program to put itself into the foreground.

Function: gpgme_error_t gpgme_op_spawn_start (gpgme_ctx_t ctx, const char *file, const char *argv[], gpgme_data_t datain, gpgme_data_t dataout, gpgme_data_t dataerr, unsigned int flags)

SINCE: 1.5.0

This is the asynchronous variant of gpgme_op_spawn.


Next: Using the Assuan protocol, Up: Miscellaneous operations   [Contents][Index]