Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Sayd on November 09, 2007, 12:53:21 pm

Title: Small patch to fix running console programs for Linux (Debian, etc)
Post by: Sayd on November 09, 2007, 12:53:21 pm
I noticed that by default my console program is not running after I hit ctrl+f10. I just see opening and immedietly closed xterm.
I got command C::B was trying to run and tryed to exec in my opened xterm:
Code
xterm -T test-cpp -e /bin/sh -c /usr/bin/cb_console_runner /home/sayd/projects/test-cpp/bin/Debug/test-cpp
But it closed too.
I fixed command, now it runs as it should be:
Code
xterm -T test-cpp -e /bin/sh -c "/usr/bin/cb_console_runner /home/sayd/projects/test-cpp/bin/Debug/test-cpp"

So I decided to fix C::B too:
Code
Index: src/plugins/compilergcc/compilergcc.cpp
===================================================================
--- src/plugins/compilergcc/compilergcc.cpp     (revision 4603)
+++ src/plugins/compilergcc/compilergcc.cpp     (working copy)
@@ -1748,8 +1748,11 @@
                 //                 -- Csh Programming Considered Harmful
                 command << DEFAULT_CONSOLE_SHELL << strSPACE;
             }
+            // each shell execution must be enclosed to "":
+            // xterm -T X -e /bin/sh -c "/usr/bin/cb_console_runner X"
+            // here is first \"
+            command << _T("\"");
         }
-
         // should console runner be used?
         if (target->GetUseConsoleRunner())
         {
@@ -1776,6 +1779,10 @@
     {
         command << execStr << strSPACE;
         command << target->GetExecutionParameters();
+        // each shell execution must be enclosed to "":
+        // xterm -T X -e /bin/sh -c "/usr/bin/cb_console_runner X"
+        // here is first \"
+        command << _T("\"");
     }
     else
     {

Don't know is it ideal to just take and patch, but it may be a place to start fixing problem.
Title: Re: Small patch to fix running console programs for Linux (Debian, etc)
Post by: huginn78 on January 15, 2009, 04:18:12 pm
I have exactly the same problem and it has been over a year from OP message.

I have Ubuntu 8.10 and codeblocks Version: 8.02svn5382.
I created new console project.
I did not play with any options.

when I click Play/Run button I got message below, and xterm windows shows for a split second.

Checking for existence: /home/amok/usr/src/cbtest/bin/Debug/cbtest
Executing: xterm -T $TERM -e /bin/sh -c /usr/bin/cb_console_runner LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. /home/amok/usr/src/cbtest/bin/Debug/cbtest  (in /home/amok/usr/src/cbtest/.)
Process terminated with status 0 (0 minutes, 0 seconds)

I wonder if I did something wrong cause I cannot believe that that kind of bug is present for over an year.

Regards.