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.js
CHANGED
|
@@ -2193,7 +2193,13 @@ var Sandbox = class extends AbstractSandbox {
|
|
|
2193
2193
|
tmpSession = session;
|
|
2194
2194
|
}
|
|
2195
2195
|
const tmpFile = outputFile ?? `/tmp/tmp_${timestamp}.out`;
|
|
2196
|
-
|
|
2196
|
+
let effectiveCmd;
|
|
2197
|
+
if (cmd.includes("\n")) {
|
|
2198
|
+
effectiveCmd = `bash -c $'${cmd.replace(/'/g, "'\\''")}'`;
|
|
2199
|
+
} else {
|
|
2200
|
+
effectiveCmd = cmd;
|
|
2201
|
+
}
|
|
2202
|
+
const nohupCommand = `nohup ${effectiveCmd} < /dev/null > ${tmpFile} 2>&1 & echo __ROCK_PID_START__$!__ROCK_PID_END__;disown`;
|
|
2197
2203
|
const response = await this.runInSession({
|
|
2198
2204
|
command: nohupCommand,
|
|
2199
2205
|
session: tmpSession,
|
|
@@ -2384,9 +2390,10 @@ var Sandbox = class extends AbstractSandbox {
|
|
|
2384
2390
|
const bucketName = envVars.ROCK_OSS_BUCKET_NAME ?? "";
|
|
2385
2391
|
const region = envVars.ROCK_OSS_BUCKET_REGION ?? "";
|
|
2386
2392
|
const endpoint = `https://oss-${region}.aliyuncs.com`;
|
|
2387
|
-
const
|
|
2393
|
+
const envPrefix = `OSS_ACCESS_KEY_ID=${credentials.accessKeyId} OSS_ACCESS_KEY_SECRET=${credentials.accessKeySecret} OSS_SESSION_TOKEN=${credentials.securityToken}`;
|
|
2394
|
+
const ossutilConfigCmd = `${envPrefix} ossutil config -e ${endpoint} --region ${region}`;
|
|
2388
2395
|
await this.arun(ossutilConfigCmd, { mode: "nohup", waitTimeout: 60 });
|
|
2389
|
-
const uploadToOssCmd =
|
|
2396
|
+
const uploadToOssCmd = `${envPrefix} ossutil cp ${remotePath} oss://${bucketName}/${objectName}`;
|
|
2390
2397
|
const uploadResult = await this.arun(uploadToOssCmd, { mode: "nohup", waitTimeout: 600 });
|
|
2391
2398
|
if (uploadResult.exitCode !== 0) {
|
|
2392
2399
|
return { success: false, message: `Sandbox to OSS upload failed: ${uploadResult.output}` };
|