rl-rock 1.3.2 → 1.3.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +10 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +10 -3
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2189,7 +2189,13 @@ var Sandbox = class extends AbstractSandbox {
|
|
|
2189
2189
|
tmpSession = session;
|
|
2190
2190
|
}
|
|
2191
2191
|
const tmpFile = outputFile ?? `/tmp/tmp_${timestamp}.out`;
|
|
2192
|
-
|
|
2192
|
+
let effectiveCmd;
|
|
2193
|
+
if (cmd.includes("\n")) {
|
|
2194
|
+
effectiveCmd = `bash -c $'${cmd.replace(/'/g, "'\\''")}'`;
|
|
2195
|
+
} else {
|
|
2196
|
+
effectiveCmd = cmd;
|
|
2197
|
+
}
|
|
2198
|
+
const nohupCommand = `nohup ${effectiveCmd} < /dev/null > ${tmpFile} 2>&1 & echo __ROCK_PID_START__$!__ROCK_PID_END__;disown`;
|
|
2193
2199
|
const response = await this.runInSession({
|
|
2194
2200
|
command: nohupCommand,
|
|
2195
2201
|
session: tmpSession,
|
|
@@ -2380,9 +2386,10 @@ var Sandbox = class extends AbstractSandbox {
|
|
|
2380
2386
|
const bucketName = envVars.ROCK_OSS_BUCKET_NAME ?? "";
|
|
2381
2387
|
const region = envVars.ROCK_OSS_BUCKET_REGION ?? "";
|
|
2382
2388
|
const endpoint = `https://oss-${region}.aliyuncs.com`;
|
|
2383
|
-
const
|
|
2389
|
+
const envPrefix = `OSS_ACCESS_KEY_ID=${credentials.accessKeyId} OSS_ACCESS_KEY_SECRET=${credentials.accessKeySecret} OSS_SESSION_TOKEN=${credentials.securityToken}`;
|
|
2390
|
+
const ossutilConfigCmd = `${envPrefix} ossutil config -e ${endpoint} --region ${region}`;
|
|
2384
2391
|
await this.arun(ossutilConfigCmd, { mode: "nohup", waitTimeout: 60 });
|
|
2385
|
-
const uploadToOssCmd =
|
|
2392
|
+
const uploadToOssCmd = `${envPrefix} ossutil cp ${remotePath} oss://${bucketName}/${objectName}`;
|
|
2386
2393
|
const uploadResult = await this.arun(uploadToOssCmd, { mode: "nohup", waitTimeout: 600 });
|
|
2387
2394
|
if (uploadResult.exitCode !== 0) {
|
|
2388
2395
|
return { success: false, message: `Sandbox to OSS upload failed: ${uploadResult.output}` };
|