[glom] Improve stderr message.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] Improve stderr message.
- Date: Tue, 29 Jun 2010 07:23:17 +0000 (UTC)
commit 45d4dea0ca8fd6ba22042f4f0ab2bbfa940880df
Author: Murray Cumming <murrayc murrayc com>
Date: Tue Jun 29 09:18:02 2010 +0200
Improve stderr message.
* glom/libglom/spawn_with_feedback.cc:
execute_command_line_and_wait_until_second_command_returns_success():
Correct the error message when a command (such as postgres) fails. As
noticed in bug #617504.
ChangeLog | 77 +++++++++++++++++++---------------
glom/libglom/spawn_with_feedback.cc | 53 ++++++++++++------------
2 files changed, 69 insertions(+), 61 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 7f8af96..f141f77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,26 +1,35 @@
+2010-06-29 Murray Cumming <murrayc murrayc com>
+
+ Improve stderr message.
+
+ * glom/libglom/spawn_with_feedback.cc:
+ execute_command_line_and_wait_until_second_command_returns_success():
+ Correct the error message when a command (such as postgres) fails. As
+ noticed in bug #617504.
+
2010-06-21 Murray Cumming <murrayc murrayc com>
Privs::get_database_users(): Check for an empty DataModel.
- * glom/libglom/privs.cc: Check that the user (listed in the group) could
- really be found.
+ * glom/libglom/privs.cc: Check that the user (listed in the group) could
+ really be found.
2010-06-21 Murray Cumming <murrayc murrayc com>
Use G_STRFUNC with std::cerr and std::cout.
- * *.h/cc: Replace hard-coded copy/pastes of method names with
+ * *.h/cc: Replace hard-coded copy/pastes of method names with
G_STRFUNC, with the help of regexxer.
2010-06-21 Murray Cumming <murrayc murrayc com>
Adapt use of Gda::ServerOperation.
- * glom/libglom/connectionpool_backends/backend.cc: add_column(),
+ * glom/libglom/connectionpool_backends/backend.cc: add_column(),
* glom/libglom/connectionpool_backends/sqlite.cc:
- add_column_to_server_operation(): set_value_at() is now templated in libgdamm,
+ add_column_to_server_operation(): set_value_at() is now templated in libgdamm,
so there is no need for the ugly (somebool ? "TRUE" : "FALSE") code.
-
+
2010-06-21 David King <amigadave amigadave com>
Explicitly link with libdl for Python module loading test
@@ -31,21 +40,21 @@
2010-06-20 Murray Cumming <murrayc murrayc com>
libglom: ConnectionPool: Simplify code.
-
+
* glom/libglom/connectionpool_backends/backend.[h|cc]:
* glom/libglom/connectionpool_backends/postgres.[h|cc]:
* glom/libglom/connectionpool_backends/postgres_central.[h|cc]:
* glom/libglom/connectionpool_backends/postgres_self.[h|cc]:
- * glom/libglom/connectionpool_backends/sqlite.[h|cc]: Remove the
- query_execute(), create_server_operation(), perform_server_operation(),
- begin_transaction(), commit_transaction() and rollback_transaction()
+ * glom/libglom/connectionpool_backends/sqlite.[h|cc]: Remove the
+ query_execute(), create_server_operation(), perform_server_operation(),
+ begin_transaction(), commit_transaction() and rollback_transaction()
convenience methods, which just hide the no-exceptions ifdefs.
But gtkmm-3.0 does not support that anyway, so we don't need it.
Just call the libgdamm methods directly.
add_column(), drop_column(), change_columns(), connect():
Remove the error output parameters which were there for the same reason.
Now they just throw.
- * glom/libglom/connectionpool.[h|cc]: Adapted code, hopefully making it
+ * glom/libglom/connectionpool.[h|cc]: Adapted code, hopefully making it
simpler.
2010-06-19 Murray Cumming <murrayc murrayc com>
@@ -55,7 +64,7 @@
* glom/base_db.cc:
* glom/libglom/python_embed/py_glom_relatedrecord.cc:
* glom/libglom/utils.cc:
- * glom/utility_widgets/db_adddel/glom_db_treemodel.cc: Use the typedef
+ * glom/utility_widgets/db_adddel/glom_db_treemodel.cc: Use the typedef
instead of guint. It is very lengthy, but it is correct.
2010-06-19 Murray Cumming <murrayc murrayc com>
@@ -64,7 +73,7 @@
* configure.ac: Don't check for avahi-ui.
* glom/application.cc: Don't include avahi-ui.h
-
+
This is lucky, because avahi-ui still has no support for GTK+ 3.
2010-06-15 Murray Cumming <murrayc murrayc com>
@@ -83,7 +92,7 @@
* glom/mode_data/box_data_portal.cc:
* glom/mode_design/dialog_database_preferences.cc:
* glom/mode_design/fields/box_db_table_definition.cc:
- * glom/report_builder.cc: Replace use of add_id() with the new add_field_id(),
+ * glom/report_builder.cc: Replace use of add_id() with the new add_field_id(),
which lets us specify the table too.
2010-06-15 Murray Cumming <murrayc murrayc com>
@@ -94,8 +103,8 @@
* glom/libglom/db_utils.cc:
* glom/libglom/python_embed/py_glom_relatedrecord.cc:
* glom/libglom/utils.cc:
- * glom/utility_widgets/db_adddel/glom_db_treemodel.cc:
- SqlBuilder::add_field_id() was renamed to add_field_value_id(), though I now
+ * glom/utility_widgets/db_adddel/glom_db_treemodel.cc:
+ SqlBuilder::add_field_id() was renamed to add_field_value_id(), though I now
notice that no value is involved when it is used for SELECT queries.
2010-06-13 Murray Cumming <murrayc murrayc com>
@@ -124,13 +133,13 @@
* glom/utility_widgets/db_adddel/db_adddel.cc:
* glom/utility_widgets/flowtable.cc:
* glom/utility_widgets/layouttoolbar.cc:
- * glom/xsl_utils.cc: Remove now-unnecessary gtk+/gtk* includes,
+ * glom/xsl_utils.cc: Remove now-unnecessary gtk+/gtk* includes,
replacing some with use of C++ API. These caused warnings due to GSEAL.
2010-06-13 Murray Cumming <murrayc murrayc com>
Depend on avahi-ui-3.0 instead of avahi-ui, though it does not officially exist.
-
+
* configure.ac: avahi-ui links to gtk-2.0, so depending on avahi-ui-3.0 is
better even if it currently only exists via my patch (emailed to d-d-l and
Lennart because I can't login to avahi.org's trac).
@@ -148,15 +157,15 @@
* configure.ac: Use gtkmm-3.0 instead of gtkmm-2.4
* glom/mode_design/print_layouts/window_print_layout_edit.cc:
Use get_related_action() instead of get_action().
- * glom/utility_widgets/cellrendererlist/cellrendererlist.[h|cc]:
- Simplify the use of the editing_started signal now that the inheritance is
+ * glom/utility_widgets/cellrendererlist/cellrendererlist.[h|cc]:
+ Simplify the use of the editing_started signal now that the inheritance is
fixed in gtkmm-3.0.
- * glom/utility_widgets/db_adddel/db_adddel.cc: Use get_first_cell() instead of
+ * glom/utility_widgets/db_adddel/db_adddel.cc: Use get_first_cell() instead of
get_first_cell_renderer().
* glom/utility_widgets/db_adddel/glom_db_treemodel.[h|cc]: iter_is_valid():
- This is no longer virtual, and no longer exists in the base class, so don't
+ This is no longer virtual, and no longer exists in the base class, so don't
call the base class implementation.
-
+
This is the master branch, for glom 2.0, using gtkmm-3.0.
See also the glom-1-16 branch, which uses gtkmm-2.4.
@@ -170,14 +179,14 @@ See also the glom-1-16 branch, which uses gtkmm-2.4.
libglom: Utils: Avoid SQL strings for extra_join for doubly-related records.
- * glom/libglom/data_structure/foundset.[h|cc]: Remove the extra_group_by
+ * glom/libglom/data_structure/foundset.[h|cc]: Remove the extra_group_by
member variable.
- * glom/base_db.cc: set_found_set_where_clause_for_portal(): Do not create
+ * glom/base_db.cc: set_found_set_where_clause_for_portal(): Do not create
the SQL GROUP BY string here.
- * glom/libglom/utils.[h|cc]: build_sql_select_with_where_clause(): Remove
- the extra_group_by parameter, instead grouping by all fields if there is
+ * glom/libglom/utils.[h|cc]: build_sql_select_with_where_clause(): Remove
+ the extra_group_by parameter, instead grouping by all fields if there is
an extra_join_by, because there is a 1-to-1 correlation.
- Also take extra_join as a Relationship instead of a SQL JOIN string, and
+ Also take extra_join as a Relationship instead of a SQL JOIN string, and
reuse the existing code to define a join from a relationship.
* glom/frame_glom.cc:
* glom/libglom/data_structure/foundset.cc:
@@ -193,8 +202,8 @@ See also the glom-1-16 branch, which uses gtkmm-2.4.
Document: get_field_used_in_relationship_to_one(): const correction.
- * glom/libglom/document/document.[h|cc]:
- get_field_used_in_relationship_to_one(): Make the relationship parameter
+ * glom/libglom/document/document.[h|cc]:
+ get_field_used_in_relationship_to_one(): Make the relationship parameter
const and adapt other code.
2010-05-25 Murray Cumming <murrayc murrayc com>
@@ -202,8 +211,8 @@ See also the glom-1-16 branch, which uses gtkmm-2.4.
libglom: build_sql_select_add_fields_to_get(): Define joins here.
* glom/libglom/data_structure/layout/usesrelationship.[h|cc]:
- Remove add_sql_join_alias_definition(), moving its code into
- Utils::build_sql_select_add_fields_to_get() because that was the only code
+ Remove add_sql_join_alias_definition(), moving its code into
+ Utils::build_sql_select_add_fields_to_get() because that was the only code
that called it.
get/set_relationship(), get/set_related_relationship(): const corrections.
* several files: Adapt to const corrections.
@@ -211,9 +220,9 @@ See also the glom-1-16 branch, which uses gtkmm-2.4.
2010-05-24 Murray Cumming <murrayc murrayc com>
UsesRelationship: Correct use of SqlBuilder for related relationships.
-
+
* glom/libglom/data_structure/layout/usesrelationship.cc:
- add_sql_join_alias_definition(): Correct the join definition for
+ add_sql_join_alias_definition(): Correct the join definition for
related relationships.
2010-05-21 Murray Cumming <murrayc murrayc com>
diff --git a/glom/libglom/spawn_with_feedback.cc b/glom/libglom/spawn_with_feedback.cc
index 71099ad..6e5078f 100644
--- a/glom/libglom/spawn_with_feedback.cc
+++ b/glom/libglom/spawn_with_feedback.cc
@@ -307,7 +307,7 @@ static std::auto_ptr<const SpawnInfo> spawn_async(const Glib::ustring& command_l
/**
* @param return_status: The return value of the command.
- * @result Whether we successfully ended the async spawn.
+ * @result Whether we successfully ended the async spawn.
*/
static bool spawn_async_end(std::auto_ptr<const SpawnInfo> info, std::string* stdout_text = 0, std::string* stderr_text = 0, int* return_status = 0)
{
@@ -333,11 +333,11 @@ static int spawn_sync(const Glib::ustring& command_line, std::string* stdout_tex
redirect_flags |= REDIRECT_STDERR;
Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create(false);
-
+
std::auto_ptr<const SpawnInfo> info = spawn_async(command_line, redirect_flags);
info->signal_finished().connect(
sigc::bind(sigc::ptr_fun(&on_spawn_info_finished), sigc::ref(mainloop) ) );
-
+
// Block until signal_finished is emitted:
mainloop->run();
@@ -352,9 +352,9 @@ static int spawn_sync(const Glib::ustring& command_line, std::string* stdout_tex
bool execute_command_line_and_wait(const std::string& command, const SlotProgress& slot_progress)
{
//Show UI progress feedback while we wait for the command to finish:
-
+
std::auto_ptr<const Impl::SpawnInfo> info = Impl::spawn_async(command, 0);
-
+
Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create(false);
info->signal_finished().connect(
sigc::bind(sigc::ptr_fun(&on_spawn_info_finished), sigc::ref(mainloop) ) );
@@ -370,7 +370,7 @@ bool execute_command_line_and_wait(const std::string& command, const SlotProgres
//Stop the timeout callback:
timeout_connection.disconnect();
-
+
int return_status = false;
const bool returned = Impl::spawn_async_end(info, 0, 0, &return_status);
if(!returned)
@@ -385,9 +385,9 @@ bool execute_command_line_and_wait(const std::string& command, const SlotProgres
output = std::string();
//Show UI progress feedback while we wait for the command to finish:
-
+
std::auto_ptr<const Impl::SpawnInfo> info = Impl::spawn_async(command, Impl::REDIRECT_STDOUT | Impl::REDIRECT_STDERR);
-
+
Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create(false);
info->signal_finished().connect(
sigc::bind(sigc::ptr_fun(&on_spawn_info_finished), sigc::ref(mainloop) ) );
@@ -403,7 +403,7 @@ bool execute_command_line_and_wait(const std::string& command, const SlotProgres
//Stop the timeout callback:
timeout_connection.disconnect();
-
+
int return_status = false;
std::string stdout_text, stderr_text;
const bool returned = Impl::spawn_async_end(info, &stdout_text, &stderr_text, &return_status);
@@ -419,7 +419,7 @@ bool execute_command_line_and_wait(const std::string& command, const SlotProgres
if(!stderr_text.empty())
{
std::cerr << G_STRFUNC << ": command produced stderr text: " << std::endl <<
- " command: " << command << std::endl <<
+ " command: " << command << std::endl <<
" error text: " << stderr_text << std::endl;
}
@@ -436,17 +436,17 @@ namespace
Glib::ustring stored_env_language;
if(!success_text.empty())
{
- // If we are going to check the text output of the second command,
+ // If we are going to check the text output of the second command,
// then we should make sure that we get a fairly canonical version of that text,
// so we set the LANG for this command.
- // We have to set LANGUAGE (a GNU extension) as well as LANG, because it
- // is probably defined on the system already and that definition would override our LANG:
+ // We have to set LANGUAGE (a GNU extension) as well as LANG, because it
+ // is probably defined on the system already and that definition would override our LANG:
// (Note that we can not just do "LANG=C;the_command", as on the command line, because g_spawn() does not support that.)
#ifdef GLOM_SPAWN_DEBUG
std::cout << std::endl << "debug: temporarily setting LANG and LANGUAGE environment variables to \"C\"" << std::endl;
#endif //GLOM_SPAWN_DEBUG
-
+
stored_env_lang = Glib::getenv("LANG");
stored_env_language = Glib::getenv("LANGUAGE");
Glib::setenv("LANG", "C", true /* overwrite */);
@@ -465,8 +465,8 @@ namespace
}
catch(const Impl::SpawnError& ex)
{
- std::cerr << G_STRFUNC << ": " << ex.what() << std::endl;
- // TODO: We should cancel the whole call if this fails three times in
+ // TODO: We should cancel the whole call if this fails three times in
+ std::cerr << G_STRFUNC << ": Exception while calling Glib::spawn_command_line_sync(): " << ex.what() << std::endl;
// a row or so.
}
@@ -476,7 +476,7 @@ namespace
#ifdef GLOM_SPAWN_DEBUG
std::cout << std::endl << "debug: restoring the LANG and LANGUAGE environment variables." << std::endl;
#endif //GLOM_SPAWN_DEBUG
-
+
Glib::setenv("LANG", stored_env_lang, true /* overwrite */);
Glib::setenv("LANGUAGE", stored_env_language, true /* overwrite */);
}
@@ -489,7 +489,7 @@ namespace
#ifdef GLOM_SPAWN_DEBUG
std::cout << " debug: output=" << stdout_output << ", waiting for=" << success_text << std::endl;
#endif //GLOM_SPAWN_DEBUG
-
+
if(stdout_output.find(success_text) == std::string::npos)
success = false;
}
@@ -499,7 +499,7 @@ namespace
#ifdef GLOM_SPAWN_DEBUG
std::cout << "debug: Success, do response" << std::endl;
#endif //GLOM_SPAWN_DEBUG
-
+
// Exit from run() in execute_command_line_and_wait_until_second_command_returns_success().
mainloop->quit();
// Cancel timeout. Actually, we also could return true here since
@@ -526,7 +526,7 @@ static bool on_timeout_delay(const Glib::RefPtr<Glib::MainLoop>& mainloop)
//Allow our mainloop.run() to return:
if(mainloop)
mainloop->quit();
-
+
return false;
}
*/
@@ -536,7 +536,7 @@ bool execute_command_line_and_wait_until_second_command_returns_success(const st
#ifdef GLOM_SPAWN_DEBUG
std::cout << "debug: Command: " << command << std::endl;
#endif //GLOM_SPAWN_DEBUG
-
+
std::auto_ptr<const Impl::SpawnInfo> info = Impl::spawn_async(command, Impl::REDIRECT_STDERR);
// While we wait for the second command to finish we
@@ -562,17 +562,17 @@ bool execute_command_line_and_wait_until_second_command_returns_success(const st
std::string stderr_text;
int return_status = 0;
const bool success = Impl::spawn_async_end(info, 0, &stderr_text, &return_status);
-
+
if(success && (return_status == EXIT_SUCCESS))
{
- /* Don't sleep here. Instead we just keep trying to connect until it succeeds,
+ /* Don't sleep here. Instead we just keep trying to connect until it succeeds,
* timing out during that if necessary.
*
*
//Sleep for a bit more, because I think that pg_ctl sometimes reports success too early.
Glib::RefPtr<Glib::MainLoop> mainloop = Glib::MainLoop::create(false);
sigc::connection connection_timeout = Glib::signal_timeout().connect(
- sigc::bind(sigc::ptr_fun(&on_timeout_delay), sigc::ref(mainloop)),
+ sigc::bind(sigc::ptr_fun(&on_timeout_delay), sigc::ref(mainloop)),
8000);
mainloop->run();
@@ -598,8 +598,8 @@ bool execute_command_line_and_wait_until_second_command_returns_success(const st
error_dialog->set_secondary_text("The command was:\n\n" + Glib::Markup::escape_text(command) + (stderr_text.empty() ? Glib::ustring("") : ("\n\n<small>" + Glib::Markup::escape_text(stderr_text) + "</small>")), true);
error_dialog->run();
*/
-
- std::cerr << G_STRFUNC << ": Child command failed. The command was: " << std::endl << stderr_text << std::endl;
+ std::cerr << G_STRFUNC << ": Child command failed. The command was: " << command << std::endl <<
+ "and the error was: " << stderr_text << std::endl;
}
else
{
@@ -615,4 +615,3 @@ bool execute_command_line_and_wait_until_second_command_returns_success(const st
} //Spawn
} //Glom
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]