If there was no argument passing here then I'd say you should be using
spawn_wait_for_attach. But that doesn't support argument passing...
... however, if you read that proc (and its helper proc) you'll see some
comments that suggest using eval/exec like you do are not the right
choice.
So maybe we should either extend (somehow) spawn_wait_for_attach to
allow argument passing, or write something like spawn_wait_for_attach
that handles arguments?
If I found the correct documentation page, I think it shouldn't be hard to extend spawn_wait_for_attach to handle arguments. And using optional arguments, it should be a very minor patch, so I'll see what I can cook up.
Thanks for the pointer, this definitely sounds like a better solution.
Actually, scratch that, we don't *need* to extend spawn_wait_for_attach. We can just give it a list with one element: "$::binfile $megs". So I'll definitely go this route.
I can add a convenience function to handle this anyway, if you'd
prefer, though
-- Cheers, Guinevere Larsen She/Her/Hers