Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update the classic package command so that it does not hang the UI wh…

…ile running
  • Loading branch information...
commit 0ecb8f71fb73c1e78d5fc5446a55a25285418c85 1 parent 47cbe52
@beanpole135 beanpole135 authored
View
10 src-qt4/life-preserver/lp-gui/LPBackend.cpp
@@ -330,7 +330,7 @@ bool LPBackend::setDiskOffline(QString pool, QString disk){
}
// =========================
-// PRIVATE FUNCTIONS
+// UTILITY FUNCTIONS
// =========================
QStringList LPBackend::getCmdOutput(QString cmd){
QProcess *proc = new QProcess;
@@ -344,10 +344,14 @@ QStringList LPBackend::getCmdOutput(QString cmd){
return out;
}
-int LPBackend::runCmd(QString cmd){
+int LPBackend::runCmd(QString cmd, QStringList args){
QProcess *proc = new QProcess;
proc->setProcessChannelMode(QProcess::MergedChannels);
- proc->start(cmd);
+ if(args.isEmpty()){
+ proc->start(cmd);
+ }else{
+ proc->start(cmd, args);
+ }
while(!proc->waitForFinished(300)){
QCoreApplication::processEvents();
}
View
2  src-qt4/life-preserver/lp-gui/LPBackend.h
@@ -47,7 +47,7 @@ class LPBackend{
static bool setDiskOffline(QString pool, QString disk);
//General utility functions
static QStringList getCmdOutput(QString);
- static int runCmd(QString);
+ static int runCmd(QString cmd, QStringList args = QStringList() );
};
#endif
View
12 src-qt4/life-preserver/lp-gui/LPGUtils.cpp
@@ -202,17 +202,19 @@ QString LPGUtils::packageHomeDir(QString username, QString packageName){
//Generate the command
- QString cmd = "tar -czf /usr/home/"+packageName+" -C /usr/home "+username;
+ QString cmd = "tar";
+ QStringList args;
+ args << "-czf" << "/usr/home/"+packageName << "-C" << "/usr/home" << username;
//Create the exclude list and skip these files
QStringList excludes;
excludes << "*flashplayer*" << "*/PBI-*.desktop"; //Don't include the flash plugin/PBI entries
for(int i=0; i<excludes.length(); i++){
- cmd.replace("-czf /usr/home", " --exclude \'"+excludes[i]+"\' -czf /usr/home");
+ args.prepend(excludes[i]); args.prepend("--exclude");
}
//Run the command
- qDebug() << "Package command:" << cmd;
- system(cmd.toUtf8()); //need to be careful with the exclude syntax (quotes) so use system command
- //qDebug() << "Command return:" << QString::number(ret);
+ qDebug() << "Package command:" << cmd << args;
+ LPBackend::runCmd(cmd, args);
+
//Check that the package was created
QString packagePath;
if(QFile::exists("/usr/home/"+packageName)){ packagePath = "/usr/home/"+packageName; }
Please sign in to comment.
Something went wrong with that request. Please try again.