}
static PyObject* Pakfire_execute(PakfireObject* self, PyObject* args, PyObject* kwds) {
- char* kwlist[] = {"command", "environ", "enable_network", "log_output", NULL};
+ char* kwlist[] = {"command", "environ", "enable_network", "interactive", NULL};
PyObject* command = NULL;
PyObject* environ = NULL;
int enable_network = 0;
- int log_output = 1;
+ int interactive = 0;
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O|Opp", kwlist, &command, &environ,
- &enable_network, &log_output))
+ &enable_network, &interactive))
return NULL;
// Check if command is a list
if (enable_network)
flags |= PAKFIRE_EXECUTE_ENABLE_NETWORK;
- // Log output?
- if (log_output)
- flags |= PAKFIRE_EXECUTE_LOG_OUTPUT;
+ // Interactive?
+ if (interactive)
+ flags |= PAKFIRE_EXECUTE_INTERACTIVE;
// Execute command
int r = pakfire_execute(self->pakfire, argv, envp, flags);
cflags |= CLONE_NEWNET;
// Make some file descriptors for stdout & stderr
- if (flags & PAKFIRE_EXECUTE_LOG_OUTPUT) {
+ if (!(flags & PAKFIRE_EXECUTE_INTERACTIVE)) {
if (pipe(env.stdout) < 0) {
ERROR(pakfire, "Could not create file descriptors for stdout: %s\n",
strerror(errno));
DEBUG(pakfire, "Waiting for PID %d to finish its work\n", pid);
- if (flags & PAKFIRE_EXECUTE_LOG_OUTPUT) {
+ if (!(flags & PAKFIRE_EXECUTE_INTERACTIVE)) {
// Close any unused file descriptors
if (env.stdout[1])
close(env.stdout[1]);
enum {
PAKFIRE_EXECUTE_NONE = 0,
PAKFIRE_EXECUTE_ENABLE_NETWORK = (1 << 0),
- PAKFIRE_EXECUTE_LOG_OUTPUT = (1 << 1),
+ PAKFIRE_EXECUTE_INTERACTIVE = (1 << 1),
};
#endif /* PAKFIRE_EXECUTE_H */
# Enter the shell
self.pakfire.execute(["/usr/bin/bash", "--login"],
- environ=self.environ, enable_network=True, log_output=False)
+ environ=self.environ, enable_network=True, interactive=True)
self.pakfire.execute(["/usr/bin/does-not-exist"])
def test_execute_output(self):
- self.pakfire.execute(["/bin/bash", "--help"], log_output=True)
+ self.pakfire.execute(["/bin/bash", "--help"])
# This is an interactive test which cannot be performed automatically
#def test_shell(self):