Support custom runtime path when launching tasks

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
Maksym Pavlenko
2021-11-09 13:31:46 -08:00
parent d4f4c1380a
commit 6870f3b1b8
10 changed files with 146 additions and 59 deletions

View File

@@ -21,6 +21,7 @@ import (
"context"
"io"
"os"
"path/filepath"
gruntime "runtime"
"strings"
@@ -127,6 +128,10 @@ func (b *binary) Start(ctx context.Context, opts *types.Any, onClose func()) (_
cancelShimLog()
f.Close()
}
// Save runtime binary path for restore.
if err := os.WriteFile(filepath.Join(b.bundle.Path, "runtime"), []byte(b.runtime), 0600); err != nil {
return nil, err
}
client := ttrpc.NewClient(conn, ttrpc.WithOnClose(onCloseWithShimLog))
return &shim{
bundle: b.bundle,