Disabling spawn(), io

chrio
Posts: 73
Joined: Mon Aug 22, 2016 11:34 am

Re: Disabling spawn(), io

Post by chrio »

One way to disable spawn locally in a profile is to override the function in a script. You could even rename spawn() if you need it for your own scripts. If we place this script at the very top of the script list it should run before any other scripts (I think).
Code: [show] | [select all] lua
--override spawn()
mysecretspawnname = mysecretspawnname or spawn -- copy with new name
function spawn(...)
   cecho("<red>Old spawn was called\n")
end
By overriding it this way we can get a hint of when it's being used, without it being able to run anything.

Sample output after running the first one:

Code: Select all

>> lua spawn(function(s) echo(s) end, "date") return
Old spawn was called
>> lua mysecretspawnname(function(s) echo(s) end, "date") return
tis okt  4 13:14:05 CEST 2016

Post Reply