PDA

View Full Version : doubt in by executing script file in qt



iswaryasenthilkumar
15th June 2015, 05:31
i want to execute the script file in qt,i used Qprocess to execute my script file.i getting error "premission denied",so i used chmod methos to execute my script file in qt,after that i execute my qt,,again i getting same error,please help me to recover thsi problem:(
Thanks in advance:o
my code below:


int Widget::call()
{
if(directory1.exists(folder))
{
qDebug()<<"directory exist";
directory1.cd(folder);
QProcess opendir;
QStringList arguments;
QString program = folder;// "/home/digital"
arguments <<"./samp.sh"; //"textfile"
opendir.start(program, arguments);
opendir.setProcessChannelMode(QProcess::ForwardedC hannels);
status = opendir.waitForFinished();
if (!status)
{
qDebug()<< opendir.errorString()<<"error";
return FAIL;
}
else
{
return SUCCESS;
}
}
else
{
qDebug()<<"diretory not exist";
}

}

wysota
15th June 2015, 06:19
What access rights does your script have? Who is the owner of the script?

iswaryasenthilkumar
15th June 2015, 07:31
i changed my mode chmod oug+rwx samp.sh

-rwxrwxrwx 1 digital_images digital_images 98 Jun 15 05:26 samp.sh

wysota
15th June 2015, 08:56
Does it work now?

jefftee
15th June 2015, 15:26
Is /home/digital really the name of your program and you are passing an argument of samp.sh? Your error is because you can't execute a directory. Change your program variable to be the actual program you want to execute (i.e. /bin/sh or /bin/bash, etc).

anda_skoa
20th June 2015, 11:44
Change your program variable to be the actual program you want to execute (i.e. /bin/sh or /bin/bash, etc).
Or the script itself.
Why execute something else if you want to execute samp.sh

Cheers,
_