Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Linux Programming
  4. xterm cannot run -e option

xterm cannot run -e option

Scheduled Pinned Locked Moved Linux Programming
c++linqdesigndebuggingfunctional
1 Posts 1 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    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::NotRunning

    I 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

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups