View Single Post
Copernicus's Avatar
Posts: 1,986 | Thanked: 7,698 times | Joined on Dec 2010 @ Dayton, Ohio
#4
Hmm, not sure why that wouldn't be working; it looks exactly like what the Qt documentation says for QProcess.

Maybe there's some sort of permissions problem?

There could also be some issue with how the argument is being passed to the shell, I suppose. You might try creating a shell script instead, i.e.:

Code:
#!/bin/sh

/opt/tenminutecore/script/tenminutecore.sh
(Assuming that tenminutecore.sh isn't already an executable shell script itself.) Then make it executable, and just use the script name instead:

Code:
process.start("yourscriptname.sh");
If all else fails, you can always fall back to using the good old fork/exec mechanism:

Code:
  pid_t pid = fork();

  if (pid == 0)
  {
    // We're inside the child process
    execl(
      "/bin/sh",
      "/bin/sh",
      "/opt/tenminutecore/script/tenminutecore.sh",
      NULL);
  }

  // If we reach this point, we are inside the parent process.
  // So, we'll wait for the child process to complete:
  int *stat_loc = NULL;
  waitpid(pid, stat_loc, 0);
Not portable to non-linux systems the way that QProcess is, but I can at least say that this works fine in Pierogi.

EDIT: There is apparently an "error()" signal for the QProcess object that gets sent if the call to "start()" fails. Maybe connecting that to a slot to see what it says will provide a bit more info as to what is going on...

Last edited by Copernicus; 2012-10-19 at 20:02. Reason: Qt also provides an error() signal
 

The Following 3 Users Say Thank You to Copernicus For This Useful Post: