From 4be841b09a6d01d2b54480456945167954e6f717 Mon Sep 17 00:00:00 2001 From: Dees_Troy Date: Wed, 26 Sep 2012 14:07:15 -0400 Subject: Fix permissions updates Also redirect stderr output on terminal commands for display in GUI console --- gui/action.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) (limited to 'gui') diff --git a/gui/action.cpp b/gui/action.cpp index 75d6c4764..1132a20a9 100644 --- a/gui/action.cpp +++ b/gui/action.cpp @@ -790,11 +790,22 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) LOGI("fix permissions started!\n"); if (simulate) { simulate_progress_bar(); - } else - PartitionManager.Fix_Permissions(); + } else { + int op_status; + if (!PartitionManager.Mount_By_Path("/data", true) || !PartitionManager.Mount_By_Path("/system", true)) + operation_end(1, simulate); - LOGI("fix permissions DONE!\n"); - operation_end(0, simulate); + DataManager::SetValue("tw_terminal_command_thread", "./sbin/fix_permissions.sh"); + DataManager::SetValue("tw_terminal_state", 1); + DataManager::SetValue("tw_background_thread_running", 1); + op_status = pthread_create(&terminal_command, NULL, command_thread, NULL); + if (op_status != 0) { + LOGE("Error starting terminal command thread, %i.\n", op_status); + DataManager::SetValue("tw_terminal_state", 0); + DataManager::SetValue("tw_background_thread_running", 0); + operation_end(1, simulate); + } + } return 0; } if (function == "dd") @@ -956,10 +967,7 @@ int GUIAction::doAction(Action action, int isThreaded /* = 0 */) simulate_progress_bar(); operation_end(op_status, simulate); } else { - command = "cd \""; - command += cmdpath; - command += "\" && "; - command += arg; + command = "cd \"" + cmdpath + "\" && " + arg + " 2>&1";; LOGI("Actual command is: '%s'\n", command.c_str()); DataManager::SetValue("tw_terminal_command_thread", command); DataManager::SetValue("tw_terminal_state", 1); @@ -1187,6 +1195,7 @@ void* GUIAction::command_thread(void *cookie) keep_going = 0; } else { // Try to read output + memset(line, 0, sizeof(line)); bytes_read = read(fd, line, sizeof(line)); if (bytes_read > 0) ui_print("%s", line); // Display output -- cgit v1.2.3