mirror of
https://github.com/game-ci/unity-builder.git
synced 2026-01-29 03:59:08 +08:00
feedback improvements
This commit is contained in:
38
dist/index.js
generated
vendored
38
dist/index.js
generated
vendored
@@ -3281,13 +3281,14 @@ class TaskService {
|
||||
if (taskElement === undefined) {
|
||||
continue;
|
||||
}
|
||||
taskElement.overrides = {};
|
||||
taskElement.attachments = [];
|
||||
if (taskElement.createdAt === undefined) {
|
||||
cloud_runner_logger_1.default.log(`Skipping ${taskElement.taskDefinitionArn} no createdAt date`);
|
||||
const extendedTask = taskElement;
|
||||
extendedTask.overrides = {};
|
||||
extendedTask.attachments = [];
|
||||
if (extendedTask.createdAt === undefined) {
|
||||
cloud_runner_logger_1.default.log(`Skipping ${extendedTask.taskDefinitionArn} no createdAt date`);
|
||||
continue;
|
||||
}
|
||||
result.push({ taskElement, element });
|
||||
result.push({ taskElement: extendedTask, element });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4421,12 +4422,33 @@ class LocalCloudRunner {
|
||||
cloud_runner_logger_1.default.log(commands);
|
||||
// On Windows, many built-in hooks use POSIX shell syntax. Execute via bash if available.
|
||||
if (process.platform === 'win32') {
|
||||
const inline = commands
|
||||
.replace(/"/g, '\\"')
|
||||
// Properly escape the command string for embedding in a double-quoted bash string.
|
||||
// Order matters: backslashes must be escaped first to avoid double-escaping.
|
||||
const escapeForBashDoubleQuotes = (stringValue) => {
|
||||
return stringValue
|
||||
.replace(/\\/g, '\\\\') // Escape backslashes first
|
||||
.replace(/\$/g, '\\$') // Escape dollar signs to prevent variable expansion
|
||||
.replace(/`/g, '\\`') // Escape backticks to prevent command substitution
|
||||
.replace(/"/g, '\\"'); // Escape double quotes
|
||||
};
|
||||
// Split commands by newlines and escape each line
|
||||
const lines = commands
|
||||
.replace(/\r/g, '')
|
||||
.split('\n')
|
||||
.filter((x) => x.trim().length > 0)
|
||||
.join(' ; ');
|
||||
.map((line) => escapeForBashDoubleQuotes(line));
|
||||
// Join with semicolons, but don't add semicolon after control flow keywords
|
||||
// Control flow keywords that shouldn't be followed by semicolons: then, else, do, fi, done, esac
|
||||
const controlFlowKeywords = /\b(then|else|do|fi|done|esac)\s*$/;
|
||||
const inline = lines
|
||||
.map((line, index) => {
|
||||
// Don't add semicolon if this line ends with a control flow keyword
|
||||
if (controlFlowKeywords.test(line.trim()) || index === lines.length - 1) {
|
||||
return line;
|
||||
}
|
||||
return `${line} ;`;
|
||||
})
|
||||
.join(' ');
|
||||
const bashWrapped = `bash -lc "${inline}"`;
|
||||
return await cloud_runner_system_1.CloudRunnerSystem.Run(bashWrapped);
|
||||
}
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user