3
$\begingroup$

I'm trying to run a wolframscript by run

RunProcess[{"wolframscript", "-file","my/script/file.wl"}];  

The script file is too lengthy to be presented here. At the end of the script, I add

$Output=OpenWrite["my/file"];
Print["mymessage"];
Exit[];

The message "mymessage" can be seen in "my/file", which shows that the script is run over. However, the runprocess doesn't stop. Does anyone meet similar problem?

$\endgroup$
  • 4
    $\begingroup$ Maybe related, I often run .m scripts on the terminal with wolfram -script file.m. I do experience that the process randomly does not finish after fully executing the script. However, I am using parallel kernels and adding CloseKernels[]; before Exit[]; helped in my case to make the process finish in about 80% of all executions. $\endgroup$ – Felix Feb 10 '17 at 3:54
  • $\begingroup$ @Felix Thanks very much. In fact, I'm also using parallel kernels. I try to add CloseKernels[] at the end of the script, as you suggested. However, it seems that is doesn't work in my case. $\endgroup$ – Wen Chern Feb 10 '17 at 4:17
  • 1
    $\begingroup$ Well, then I don't know what it could be, but I'm curious to see what other people will say. However, I recommend that you try to create a simple dummy script that can reproduce the effect and post it here. $\endgroup$ – Felix Feb 10 '17 at 4:25
  • $\begingroup$ @ Felix Thanks again. In fact another package (called "FIRE") is imported in the script. I'm not very familiar with the detail of this package, so I've no idea how to simplify the script to reproduce the effect. However. I try to turn off parallel mapping. The problem persists. $\endgroup$ – Wen Chern Feb 10 '17 at 4:48
  • 1
    $\begingroup$ @ Felix Sorry for that I didn't correctly turn off parallel mapping in this package before. After I do it correctly, the problem doesn't occur any more. Thanks you very much. $\endgroup$ – Wen Chern Feb 10 '17 at 5:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.