0

/usr/local/bin/rdesktop launched from terminal connects me to host

following launches rdesktop without arguments:

 QString program = "/usr/local/bin/rdesktop";
    QStringList args;
    QProcess *process = new QProcess(this);
    args << m_address;
    process->start("open \""+program);
    process->setArguments(args);

have tried with same result:

process->startDetached("open \""+program);
process->execute("open \""+program);

also with arguments overloaded func process.start("open \""+program, args) and it doesnt launch anything and no error message either.

some advice please?

Psypher
  • 10,717
  • 12
  • 59
  • 83
brucen
  • 35
  • 1
  • 5
  • `open` only works with apps, doesn't it? – Droppy Jul 03 '15 at 08:12
  • Hi Droppy , open - opens the app i am trying to open, problem i am facing is with the arguments. program works well in linux and windows, but first time i am trying it on mac and well im ...stuck. – brucen Jul 03 '15 at 08:21

2 Answers2

0
...
process->start("open \""+program);
process->setArguments(args);

As you're setting the arguments after you call QProcess::start, the process will not receive the arguments when launching your desired program.

As the documentation for QProcess::setArguments states

Set the arguments to pass to the called program when starting the process. This function must be called before start().

TheDarkKnight
  • 27,181
  • 6
  • 55
  • 85
  • Hi TheDarkKnight, thanks for the tip. The following worked (documentation link): process->setProgram(program); process->setArguments(args); process->start(); – brucen Jul 03 '15 at 08:40
0

Worked...

QProcess *process = new QProcess(this);

QString program = "/usr/local/bin/rdesktop";

QStringList args;

args << m_address;

process->setProgram(program);

process->setArguments(args);

process->start();

brucen
  • 35
  • 1
  • 5