58 lines
2.4 KiB
Diff
58 lines
2.4 KiB
Diff
From 921ee84f80adda64fb0a7125f9f709bff416945c Mon Sep 17 00:00:00 2001
|
|
From: zhongtao <zhongtao17@huawei.com>
|
|
Date: Tue, 26 Dec 2023 10:17:19 +0800
|
|
Subject: [PATCH 69/71] add exec workdir support for oci runtime
|
|
|
|
Signed-off-by: zhongtao <zhongtao17@huawei.com>
|
|
---
|
|
src/cmd/isula/stream/exec.h | 2 +-
|
|
src/cmd/isulad-shim/process.c | 4 ++++
|
|
src/daemon/modules/runtime/isula/isula_rt_ops.c | 3 +++
|
|
3 files changed, 8 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/cmd/isula/stream/exec.h b/src/cmd/isula/stream/exec.h
|
|
index 83a4af06..8d8e4347 100644
|
|
--- a/src/cmd/isula/stream/exec.h
|
|
+++ b/src/cmd/isula/stream/exec.h
|
|
@@ -48,7 +48,7 @@ extern "C" {
|
|
"Username or UID (format: <name|uid>[:<group|gid>])", \
|
|
NULL }, \
|
|
{ CMD_OPT_TYPE_STRING_DUP, false, "workdir", 0, &(cmdargs).custom_conf.workdir, \
|
|
- "Working directory inside the container, supported only when runtime is lcr", NULL }
|
|
+ "Working directory inside the container", NULL }
|
|
|
|
extern const char g_cmd_exec_desc[];
|
|
extern const char g_cmd_exec_usage[];
|
|
diff --git a/src/cmd/isulad-shim/process.c b/src/cmd/isulad-shim/process.c
|
|
index 97524f1a..06726a40 100644
|
|
--- a/src/cmd/isulad-shim/process.c
|
|
+++ b/src/cmd/isulad-shim/process.c
|
|
@@ -1274,6 +1274,10 @@ static void get_runtime_cmd(process_t *p, const char *log_path, const char *pid_
|
|
#endif
|
|
params[i++] = "--process";
|
|
params[i++] = process_desc;
|
|
+ if (p->state->cwd != NULL) {
|
|
+ params[i++] = "--cwd";
|
|
+ params[i++] = p->state->cwd;
|
|
+ }
|
|
} else {
|
|
params[i++] = "create";
|
|
params[i++] = "--bundle";
|
|
diff --git a/src/daemon/modules/runtime/isula/isula_rt_ops.c b/src/daemon/modules/runtime/isula/isula_rt_ops.c
|
|
index fbb779f7..c754fc54 100644
|
|
--- a/src/daemon/modules/runtime/isula/isula_rt_ops.c
|
|
+++ b/src/daemon/modules/runtime/isula/isula_rt_ops.c
|
|
@@ -1345,6 +1345,9 @@ static int preparation_exec(const char *id, const char *runtime, const char *wor
|
|
p.runtime_args = (char **)runtime_args;
|
|
p.runtime_args_len = runtime_args_len;
|
|
copy_process(&p, process);
|
|
+ if (params->workdir != NULL) {
|
|
+ p.cwd = (char *)params->workdir;
|
|
+ }
|
|
|
|
ret = create_process_json_file(workdir, &p);
|
|
if (ret != 0) {
|
|
--
|
|
2.25.1
|
|
|