Author Topic: PCL/PJSR: No way to continue after executeGlobal() returns with false  (Read 2887 times)

Offline georg.viehoever

  • PTeam Member
  • PixInsight Jedi Master
  • ******
  • Posts: 2132
Hi,

(ordinary mortals: you can stop reading here, it gets down into the underworld of PI  >:D )

the following happens when using the SystemCommand module described in http://pixinsight.com/forum/index.php?topic=1791.0, but probably happens with any (standard) PI module that returns false on executeGlobal() when used from PJSR:

The following PJSR script should execute "ls", "echo run 1", fail on "bla bla" and continue with "echo run 2":
Code: [Select]
var testFunc=function(sCommandLine){
      var pSystemCommand=new SystemCommand;
      with (pSystemCommand) {
         commandLine=sCommandLine;
      }
      console.writeln("starting ",sCommandLine);
      try {
         pSystemCommand.executeGlobal();
      }catch(e){
         console.writeln("caught ",sCommandLine);
      }
      console.writeln("done ",sCommandLine);
}

testFunc("ls");
testFunc("echo run 1");
// following fails because bla does not exist as executable
testFunc("bla bla");
// never gets here.
testFunc("echo run 2");

In reality, it never gets beyond "bla bla", because in this case on the C++ level,  SystemCommandInstance::executeGlobal() returns false. The output is this:

Code: [Select]
run -execute-mode=auto "/home/georg/tmp/scripts/test.js"

Processing script file: /home/georg/tmp/scripts/test.js
starting ls

SystemCommand: Global context
Running command (see terminal for ouput): ls
Running with maxTime=100
Makefile
Makefile~
makefile-x86_64
makefile-x86_64~
x86_64
Did run (see terminal for ouput): ls
0.161 s
done ls
starting echo run 1

SystemCommand: Global context
Running command (see terminal for ouput): echo run 1
Running with maxTime=100
run 1
Did run (see terminal for ouput): echo run 1
0.186 s
done echo run 1
starting bla bla

SystemCommand: Global context
Running command (see terminal for ouput): bla bla
Running with maxTime=100
Did run (see terminal for ouput): bla bla
<* failed *>

Cheers,
Georg
Georg (6 inch Newton, unmodified Canon EOS40D+80D, unguided EQ5 mount)