Reputation: 1554
I would like to execute an external program from inside a Rascal program without creating a new process using createProcess()
and killProcess()
. Is this possible or have I missed something in the documentation?
Thanks.
Upvotes: 1
Views: 76
Reputation: 6696
It's a matter of calling the readEntireStream
function:
rascal>readEntireStream(createProcess("ls", ["-l","-a"]))
str: "total 192drwxr-xr-x@ 5 jurgenv admin 170 Mar 24 21:10 .drwxr-xr-x@ 5 jurgenv admin 170 Mar 3 20:05 ..-rwxr-xr-x 1 jurgenv admin 25160 Feb 4 18:43 eclipse-rw-r--r--@ 1 jurgenv admin 637 Apr 3 13:58 eclipse.ini-rw-r--r-- 1 jurgenv admin 64679 Mar 24 21:10 hs_err_pid25121.log"
Upvotes: 1
Reputation: 1406
If you mean by "execute a command": execute a command of the Operating System you are running on, then the answer is no this not possible. OS commands are always executed in a separate process. Can you give an example of your use case?
Upvotes: 0