MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / getSandboxNsjailOptions

Function getSandboxNsjailOptions

lib/exec.ts:333–349  ·  view source on GitHub ↗
(command: string, args: string[], options: ExecutionOptions)

Source from the content-addressed store, hash-verified

331}
332
333export function getSandboxNsjailOptions(command: string, args: string[], options: ExecutionOptions): NsJailOptions {
334 // If we already had a custom cwd, use that.
335 if (options.customCwd) {
336 let relativeCommand = command;
337 if (command.startsWith(options.customCwd)) {
338 relativeCommand = path.relative(options.customCwd, command);
339 if (path.dirname(relativeCommand) === '.') {
340 relativeCommand = `./${relativeCommand}`;
341 }
342 }
343 return getNsJailOptions('sandbox', relativeCommand, args, options);
344 }
345
346 // Else, assume the executable should be run as `./exec` and run it from its directory.
347 options = {...options, customCwd: path.dirname(command)};
348 return getNsJailOptions('sandbox', `./${path.basename(command)}`, args, options);
349}
350
351export function getSandboxCEWrapperOptions(command: string, args: string[], options: ExecutionOptions): NsJailOptions {
352 return getCeWrapperOptions('sandbox', command, args, options);

Callers 1

sandboxNsjailFunction · 0.85

Calls 1

getNsJailOptionsFunction · 0.85

Tested by

no test coverage detected