Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Execute system command using Qt

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
User avatar
graciano
Posts: 194
Joined: 2008-07-07 11:36
Location: Portugal

Execute system command using Qt

#1 Post by graciano »

Hi,
I was writing code to execute system command, using GDM3 an logged in as root (just commented line #auth required pam_succeed_if.so user != root quiet_success , in /etc/pam.d/gdm3).
When i execute:

Code: Select all

void criarWindowsDialog::on_pushButton_2_clicked()
{
    ui->commandTextEdit->append("Processo iniciado ...");
    QProcess processo;
    QString comando;
    QStringList args;
    QString fullCommand;
    QString stdOut;
    QString stdError;

    //comando 1 - limpar a pasta
    comando = "rm";
    args.clear();
    args<<"-f"<<"/home/srp/imagens/windows/*";
    fullCommand = comando;
    for(int i = 0; i < args.count(); i++)
        fullCommand += " " + args.at(i);
    processo.start(comando,args,QIODevice::ReadOnly);
    processo.waitForFinished();
    stdOut = processo.readAllStandardOutput();
    stdError = processo.readAllStandardError();
    ui->commandTextEdit->append(fullCommand);
    ui->stdOutTextEdit->append(stdOut);
    ui->stdErrorTextEdit->append(stdError);
...
... e get "Failed to open terminal.TERM environment variable needs set." from stdError.
What changes to the TERM variable, if so, do i need to do?

Thanks

Note: no security issues needed.

Post Reply