Changeset 0ecb8f7


Ignore:
Timestamp:
Oct 28, 2013 8:50:13 AM (6 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, 9.2-release, releng/10.0, releng/10.0.1
Children:
cb30a16
Parents:
47cbe52
Message:

Update the classic package command so that it does not hang the UI while running

Location:
src-qt4/life-preserver/lp-gui
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/life-preserver/lp-gui/LPBackend.cpp

    r6a2483b r0ecb8f7  
    331331 
    332332// ========================= 
    333 //             PRIVATE FUNCTIONS 
     333//             UTILITY FUNCTIONS 
    334334// ========================= 
    335335QStringList LPBackend::getCmdOutput(QString cmd){ 
     
    345345} 
    346346 
    347 int LPBackend::runCmd(QString cmd){ 
     347int LPBackend::runCmd(QString cmd, QStringList args){ 
    348348  QProcess *proc = new QProcess; 
    349349  proc->setProcessChannelMode(QProcess::MergedChannels); 
    350   proc->start(cmd); 
     350  if(args.isEmpty()){    
     351    proc->start(cmd); 
     352  }else{ 
     353    proc->start(cmd, args); 
     354  } 
    351355  while(!proc->waitForFinished(300)){ 
    352356    QCoreApplication::processEvents(); 
  • src-qt4/life-preserver/lp-gui/LPBackend.h

    r6a2483b r0ecb8f7  
    4848        //General utility functions 
    4949        static QStringList getCmdOutput(QString); 
    50         static int runCmd(QString);      
     50        static int runCmd(QString cmd, QStringList args = QStringList() );       
    5151 
    5252}; 
  • src-qt4/life-preserver/lp-gui/LPGUtils.cpp

    r47cbe52 r0ecb8f7  
    203203   
    204204  //Generate the command 
    205   QString cmd = "tar -czf /usr/home/"+packageName+" -C /usr/home "+username; 
     205  QString cmd = "tar"; 
     206  QStringList args; 
     207  args << "-czf" << "/usr/home/"+packageName << "-C" << "/usr/home" << username; 
    206208  //Create the exclude list and skip these files 
    207209  QStringList excludes; 
    208210    excludes << "*flashplayer*" << "*/PBI-*.desktop"; //Don't include the flash plugin/PBI entries 
    209211  for(int i=0; i<excludes.length(); i++){ 
    210     cmd.replace("-czf /usr/home", " --exclude \'"+excludes[i]+"\' -czf /usr/home"); 
     212    args.prepend(excludes[i]); args.prepend("--exclude"); 
    211213  } 
    212214  //Run the command 
    213   qDebug() << "Package command:" << cmd; 
    214   system(cmd.toUtf8()); //need to be careful with the exclude syntax (quotes) so use system command 
    215   //qDebug() << "Command return:" << QString::number(ret); 
     215  qDebug() << "Package command:" << cmd << args; 
     216  LPBackend::runCmd(cmd, args); 
     217 
    216218  //Check that the package was created 
    217219  QString packagePath; 
Note: See TracChangeset for help on using the changeset viewer.