5 #include "MainWindow.h"
6 #include "misc/String.h"
7 #include "platform/PlatformException.h"
12 ProgramSocketThread::ProgramSocketThread(Misc::SmartPointer
<Platform::TCPSocket
> socket
,
13 Misc::SmartPointer
<Platform::Memory
> memory
) : socket(socket
), memory(memory
) {
16 void ProgramSocketThread::run() {
17 while(socket
->is_valid()) {
18 std::cout
<< "ProgramSocketThread: checking data . . ." << std::endl
;
19 std::cout
<< "Received \"" << socket
->get_data() << "\"" << std::endl
;
28 arguments
= settings
.value("Program/arguments").toString().toStdString();
29 executable
= settings
.value("Program/executable").toString().toStdString();
30 port
= settings
.value("Program/port").toInt();
31 in_xterm
= settings
.value("Program/in-xterm").toBool();
33 arguments
= Misc::StreamAsString() << settings
.value("Core/aesalon-path").toString().toStdString()
34 << " --use-port " << port
<< " " << executable
<< " " << arguments
;
36 Platform::ArgumentList argument_list
;
38 argument_list
.from_string(arguments
+ " ");
40 /*bi_pipe = new Platform::BidirectionalPipe(argument_list, true);*/
43 std::cout
<< "in child, execv'ing . . ." << std::endl
;
44 std::cout
<< "\targument_list[0]: \"" << argument_list
.get_argument(0) << "\"\n";
45 std::cout
<< "\targument_list[1]: \"" << argument_list
.get_argument(1) << "\"\n";
46 std::cout
<< "\targument_list[2]: \"" << argument_list
.get_argument(2) << "\"\n";
47 std::cout
<< "\targument_list[3]: \"" << argument_list
.get_argument(3) << "\"\n";
48 std::cout
<< "\targument_list[4]: \"" << argument_list
.get_argument(4) << "\"\n";
49 execv(argument_list
.get_argument(0).c_str(), argument_list
.get_as_argv());
50 throw Misc::Exception("Couldn't execute file . . .");
53 memory
= new Platform::Memory();
56 while(!socket
.is_valid()) {
58 socket
= new Platform::TCPSocket("127.0.0.1", port
);
60 catch(Platform::PlatformException pe
) {
65 socket_thread
= new ProgramSocketThread(socket
, memory
);
66 socket_thread
->start(QThread::HighPriority
);
70 } // namespace Aesalon