- DLOG("matching assignment, would do:\n");
- if (current->type == A_COMMAND) {
- DLOG("execute command %s\n", current->dest.command);
- char *full_command;
- sasprintf(&full_command, "[id=\"%d\"] %s", window->id, current->dest.command);
- struct CommandResult *command_output = parse_command(full_command);
- free(full_command);
+ /* Store that we ran this assignment to not execute it again. We have
+ * to do this before running the actual command to prevent infinite
+ * loops. */
+ window->nr_assignments++;
+ window->ran_assignments = srealloc(window->ran_assignments, sizeof(Assignment *) * window->nr_assignments);
+ window->ran_assignments[window->nr_assignments - 1] = current;