On Tue, Oct 16, 2012 at 03:08:45PM +0200, Sven Van Caekenberghe wrote:
> I understand that it would be nice eventually to have images saved like that 
> automatically.
> 
> It is still a pity that the VM has to change for that ;-)

If you don't want to do it in the VM, you can do it with a shell script.
Just make a 512 byte file that starts with the shebang line that you
want to use, prepend it to the saved image file (with /bin/cat) and set
file mode executable (chmod).

You could also do this from a method in the image if you prefer, although
chmod would require FFI or OSProcess.

Dave


> 
> But as far as I understood, the first 512 bytes are skipped today as well, 
> so if you (or any program) does a binary edit of the image header, it would 
> work, no ?
> 
> On 16 Oct 2012, at 14:58, Camillo Bruni <[email protected]> wrote:
> 
> > 
> > On 2012-10-16, at 14:49, Damien Cassou <[email protected]> wrote:
> > 
> >> On Sat, Oct 13, 2012 at 10:51 PM, Camillo Bruni <[email protected]> 
> >> wrote:
> >>>> It is supported, see for instance: 
> >>>> http://marc.info/?l=squeak-vm-dev&m=124049248310307&w=2
> >>> awesome! strange that nobody promoted that so far...
> >>> well I guess yet another of these hidden treasures ;)
> >> 
> >> so, how can we have all images start with that line?
> > 
> > 
> > we have to change the VM, yay! :/, to add a language side-hook:
> > 
> > https://code.google.com/p/cog/issues/detail?id=101
> > 
> > so once I have a bit of time, I'll change the VM to always include this 
> > header.
> > Load support for such images exist since the early days apparently.
> > 
> > I will simply add a #header argument to the #snapshot method, that way the
> > image can pass an arbitrary header to the VM on image save.
> > 
> > best
> > cami
> 

Reply via email to