<table><tr><td style="">asemke added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D12565">View Revision</a></tr></table><br /><div><div><blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D12565#255166" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D12565#255166</a>, <a href="https://phabricator.kde.org/p/sirgienko/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@sirgienko</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><blockquote style="border-left: 3px solid #8C98B8;
          color: #6B748C;
          font-style: italic;
          margin: 4px 0 12px 0;
          padding: 8px 12px;
          background-color: #F8F9FC;">
<div style="font-style: normal;
          padding-bottom: 4px;">In <a href="https://phabricator.kde.org/D12565#255055" style="background-color: #e7e7e7;
          border-color: #e7e7e7;
          border-radius: 3px;
          padding: 0 4px;
          font-weight: bold;
          color: black;text-decoration: none;">D12565#255055</a>, <a href="https://phabricator.kde.org/p/asemke/" style="
              border-color: #f1f7ff;
              color: #19558d;
              background-color: #f1f7ff;
                border: 1px solid transparent;
                border-radius: 3px;
                font-weight: bold;
                padding: 0 4px;">@asemke</a> wrote:</div>
<div style="margin: 0;
          padding: 0;
          border: 0;
          color: rgb(107, 116, 140);"><p>Cleaning up in logout() is ok. Sending emit loginDone() in readOutput() is not very clean. Everything login related should be done in login().  What do you mean with "we emit this signal before we real finish preparation"? Is  m_process->waitForReadyRead(); in OctaveSession::login() not enough to collect and to parse the initial output of octave?</p></div>
</blockquote>

<p>Acording to Qt documentation</p>

<blockquote style="border-left: 3px solid #a7b5bf; color: #464c5c; font-style: italic; margin: 4px 0 12px 0; padding: 4px 12px; background-color: #f8f9fc;"><p><tt style="background: #ebebeb; font-size: 13px;">waitForReadyRead()</tt>: Blocks until new data is available for reading and the readyRead() signal has been emitted</p></blockquote>

<p>And we have <tt style="background: #ebebeb; font-size: 13px;">connect ( m_process, SIGNAL ( readyReadStandardOutput() ), SLOT ( readOutput() ) );</tt><br />
 But we wait only for <tt style="background: #ebebeb; font-size: 13px;">readyRead()</tt> signal and qt don't garantee, that the slot, connected to this signal, already have be executed.<br />
 So, we could emit <tt style="background: #ebebeb; font-size: 13px;">loginDone</tt> before backend set m_prompt and m_tempDir. Now it doesn't happends, but it could be possible or I am wrong with it and it's not a problem.</p>

<p>I was thinking about getting the octave prompt like lua backend: connect output to special function for reading prompt, which at the end of work reconnect output to parsing functions and emit loginDone signal.<br />
 Well, now lua emit loginDone signal in <tt style="background: #ebebeb; font-size: 13px;">login</tt> function, so sometimes I loose first comand in the lua tests, because the backend run expression before reading the prompt and I got something like this:<br />
 <tt style="background: #ebebeb; font-size: 13px;">reading the intro message  "Lua 5.2.4  Copyright (C) 1994-2015 Lua.org, PUC-Rio\n> print(2+2)\n4\n> "</tt></p>

<p>But maybe I have made a mistake, when have move the signal emit statement in this patch.</p></div>
</blockquote>

<p>Yes, this all is a bit inconsistent in Cantor for different backends. I'd rather go for a solution where all the initial stuff is done in login() only. So, parsing of the promt, if required, emitting of signals etc. should be done in login(). This is the case for example in juliasession.cpp where the output is read until "ready" comes. parseOutput() should be used for parsing of the expression outputs only. This would lead to a more clear and consistent architecture in Cantor. Once this is done in octavesession, this should also solve the problem you propose to fix here.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R55 Cantor</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D12565">https://phabricator.kde.org/D12565</a></div></div><br /><div><strong>To: </strong>sirgienko, Cantor, asemke<br /><strong>Cc: </strong>Cantor, KDE Edu, narvaez, apol<br /></div>