xterm cannot run -e option
-
Here is my "work in progress " C++ code. I am trying to use -e option of xtrem to run a test command "lsusb" and trying to write same command to running xterm. Both fails.
#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
QString text;
QProcess *QP = new QProcess();// use Lambda: // No need to define a slot function... connect(QP, &QProcess::errorOccurred, \[=\](QProcess::ProcessError error) { qDebug() << "error enum val = " << error << endl; }); // modify above for status connect(QP, &QProcess::stateChanged, \[=\](QProcess::ProcessState state) { qDebug() << "state enum val = " << state << endl; }); { //QP->start("sh", QStringList()<< "-c" << " xterm " ); // works //QP->start("sh", QStringList() << "-c" << " xterm -maximized "); // works //-e lsusb " ); //no spaces on -c ! QP->start("sh", QStringList() << "-c" << " xterm -maximized -e lsusb " ); //no spaces on -c ! if(QP->waitForStarted()) { text = "Process started "; qDebug()<write("lsusb"); text = " Item written count "; text += QString::number(item\_count); qDebug()<write("xterm -fa 'Monospace' -fs 14"); text = " Item written count "; text += QString::number(item\_count); qDebug()<
Here is my debug output
state enum val = QProcess::Starting
state enum val = QProcess::Running
"Process started "
" Item written count 5"
" Item written count 28"
state enum val = QProcess::NotRunningI did RTFM and see this
-e program [ arguments ... ]
This option specifies the program (and its command line arguments) to be run in the xterm window. It also sets the window title and icon name to be the basename of the program being executed if neither -T nor -n are given on the command line. This must be the last option on the command line.Is there another command / option I need to add ?
Please note I have no issues running other options , only -e is not working as expected.
Thanks for your