appjaws wrote 32 lines
On 18/01/13 17:44, Malcolm Poole wrote:
> On 18/01/13 11:25, Paul wrote:
>> I am running kubuntu linux which runs KDE as the desktop and have
>> installed lazarus 1,0,4, FPC version 2.6.0. x86_64-linux-gtk2.
>> The problem:
>> When I choose run, the program compiles just fine but the output is not
>> displayed in a terminal window. This happens with all of my programs
>> running on lazarus.
>> I have the same lazarus, fpc and programs running on windows and on
>> windows as soon as the program is compiled a terminal window pops up
>> and
>> displayed the results.
>
> From the 'Run' menu, select 'Run Parameters' and check 'Use Launching
> Application'. If Lazarus complains that it can't find the launching
> application, choose another from the combobox list
<snip>
Thank you for your reply Malcolm and leledumbo,
The rub parameter for selection is:-
/usr/bin/konsole -T 'Lazarus Run Output' -e
$(LazarusDir)/tools/runwait.sh $(TargetCmdLine)
If I select this and then run a program execution is stopped but the
console window (from DeBug window-Terminal output) shows the following:-
QDBusConnection: session D-Bus connection created before
QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before
QCoreApplication. Application may misbehave.
Fontconfig warning: "/etc/fonts/conf.d/50-user.conf", line 9: reading
configurations from ~/.fonts.conf is deprecated.
The launcher app is for debugging DLL or .so files.
specifying a shell as launcher app will in most cases not work, because then the debugger believes it should debug the shell itself. (which is not going to work, because the shell has no debug info, and if it had it would not help you either, as the debugger would still not debug your app)
Show quoted text 18 lines
If I don't check 'Use Launching Application' but have the debug
console showing I get the following:
[6n[H[m[H[2J9 9 2 2 8 5 4 3 5 10 3 4 6 8 6 8 8 1 3 2 10 5 6 4 1
3 10 4 5 8 9 10 1 3 8 10 6 1
0 5 1 5 8 5 4 4 5 9 1 3 2
[1BPlease Press <Enter> To Quit
[1B
This program should clear screen and generate random numbers
but the [6n[H[m[H[2J and[1B seem to be control codes, also the
console does not refresh.
So as an example how can I check that a program is working correctly
without having to run a final executable?
If I './executable' it run and clears screen perfectly.
I just can't see why the linux version will not work the same as the
windows version.
Windows the OS does provide the command window (not as cmd.com, but just as part of your app.
On linux the kernel provides /dev/pty (or dev/tty). That is the terminal. The representation of its content is done by an application (such as sh, bash,xterm).
The IDE also can represent it, but it does not do any escape sequences. If someone wants to work on that, and provide patches...
-------
There are exactly 2 alternatives (both are workarounds, and not really user friendly):
1) Launch from a console, get the PID, and use the IDE "Run" > "Attach"
2) start a shell or xterm. run "pty" in that shell, it will report something like "/dev/pty4" (the number may vary). The shell is going to display anything that happens in this pty.
In Lazarus open the Tools> Options. Go to the debugger page. In the property grid find "ConsoleTty" (does not exist on windows, only linux) and enter the result you got from pty.
Now Lazarus will redirect the debugged apps in and output. If you need input, you must prevent the shell from reading it. run "tail -f some_existing_file_that_does_not_change" (Though ctrl-c,d,z etc will go to the shell, not your app)
Once you close the shell, you must unset the option in Lazarus.
That is all there currently is. Until someone has time to implement a nice terminal emulation in the IDE.
If you need input too, ensure