diff options
author | Kris Moore <kris@pcbsd.org> | 2016-03-09 20:09:18 -0500 |
---|---|---|
committer | Kris Moore <kris@pcbsd.org> | 2016-03-09 20:09:18 -0500 |
commit | e5ac1b024f62040329c055a8a628d7a8953659dd (patch) | |
tree | 4f51a1b8c9f7f0531f8efdbe85cfff2f972b9cee | |
parent | Convert TTYprocess to a QFile, add some testing for execvp (which makes (diff) | |
download | lumina-e5ac1b024f62040329c055a8a628d7a8953659dd.tar.gz lumina-e5ac1b024f62040329c055a8a628d7a8953659dd.tar.bz2 lumina-e5ac1b024f62040329c055a8a628d7a8953659dd.zip |
Fix setting up the execvp args, the [0] needs to be the actual program,
followed by the arguments
-rw-r--r-- | desktop-utilities/lumina-terminal/TtyProcess.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/desktop-utilities/lumina-terminal/TtyProcess.cpp b/desktop-utilities/lumina-terminal/TtyProcess.cpp index f72b37a2..050d1338 100644 --- a/desktop-utilities/lumina-terminal/TtyProcess.cpp +++ b/desktop-utilities/lumina-terminal/TtyProcess.cpp @@ -21,15 +21,18 @@ TTYProcess::~TTYProcess(){ bool TTYProcess::startTTY(QString prog, QStringList args){ //Turn the program/arguments into C-compatible arrays char cprog[prog.length()]; strcpy(cprog, prog.toLocal8Bit().data()); - char *cargs[args.length()+1]; - for(int i=0; i<args.length()+1; i++){ - if(i<args.length()){ + char *cargs[args.length()+2]; + QByteArray nullarray; + for(int i=0; i<args.length()+2; i++){ + // First arg needs to be the program + if ( i == 0 ) { + cargs[i] = new char[ prog.toLocal8Bit().size()+1]; + strcpy( cargs[i], prog.toLocal8Bit().data() ); + } else if(i<args.length()){ cargs[i] = new char[ args[i].toLocal8Bit().size()+1]; strcpy( cargs[i], args[i].toLocal8Bit().data() ); - cargs[i][strlen(args[i].toLocal8Bit())] = NULL; }else{ - cargs[i] = new char[1]; - strcpy(cargs[i],"\0"); + cargs[i] = NULL; } } qDebug() << "PTY Start:" << prog; |