mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-11-06 12:51:54 +00:00
Merge commit 'd636cae93c5a67509365358439d680f4ce473979' into torch/provider-runtime
This commit is contained in:
commit
69f1cef773
3 files changed
+55
-2
No files matched your search
@@ -15,6 +15,18 @@ function unitQuote(value) {
|
||||
return `"${String(value).replaceAll('\\', '\\\\').replaceAll('"', '\\"')}"`;
|
||||
}
|
||||
|
||||
// WorkingDirectory is a scalar path, not an ExecStart-style quoted word.
|
||||
// C-escape special path bytes and escape systemd specifiers without adding quotes.
|
||||
function unitPath(value) {
|
||||
return [...String(value)].map(character => {
|
||||
if (character === '%') return '%%';
|
||||
if (character.charCodeAt(0) <= 0x20 || character === '\\' || character === '"') {
|
||||
return `\\x${character.charCodeAt(0).toString(16).padStart(2, '0')}`;
|
||||
}
|
||||
return character;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function configPath(repositoryRoot) {
|
||||
return join(repositoryRoot, '.torch', 'torch.yaml');
|
||||
}
|
||||
@@ -39,7 +51,7 @@ function render({ repositoryRoot, projectId, command, digest, env }) {
|
||||
? `Environment=${unitQuote(`XDG_DATA_HOME=${resolve(env.XDG_DATA_HOME)}`)}\n` : '';
|
||||
const service = [
|
||||
'[Unit]', `Description=TORCH system schedules for ${projectId}`, '', '[Service]', 'Type=oneshot',
|
||||
`WorkingDirectory=${unitQuote(repositoryRoot)}`, environment.trimEnd(),
|
||||
`WorkingDirectory=${unitPath(repositoryRoot)}`, environment.trimEnd(),
|
||||
`ExecStart=${args.map(unitQuote).join(' ')}`, '',
|
||||
].filter((line) => line !== '').join('\n') + '\n';
|
||||
const timer = [
|
||||
|
||||
Reference in new issue
Block a user