Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/runs-on.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ function machineName() {
if (process.env.ATRIS_MACHINE_NAME) name = process.env.ATRIS_MACHINE_NAME;
if (!name && process.platform === 'darwin') {
try {
name = execFileSync('scutil', ['--get', 'ComputerName'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], timeout: 2000 }).trim();
// scheduled jobs often run without /usr/sbin on PATH, so call it by its
// full path; otherwise a job would see the network name instead
const scutil = require('fs').existsSync('/usr/sbin/scutil') ? '/usr/sbin/scutil' : 'scutil';
name = execFileSync(scutil, ['--get', 'ComputerName'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], timeout: 2000 }).trim();
} catch { name = ''; }
}
if (!name) name = String(os.hostname() || '').replace(/\.local$/i, '');
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "atris",
"version": "3.82.19",
"version": "3.82.20",
"description": "you say what you want in plain words. atris builds it, checks it, and shows you proof. project memory your coding agents share across sessions.",
"mcpName": "io.github.atrislabs/atris",
"main": "bin/atris.js",
Expand Down
8 changes: 8 additions & 0 deletions test/runs-on.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,3 +342,11 @@ test('a machine can keep the names it answers to in ~/.atris/RUNS_AS', () => wit
if (saved !== undefined) process.env.ATRIS_RUNS_AS = saved;
}
}));

test('this Mac is named the same with or without /usr/sbin on PATH', { skip: process.platform !== 'darwin' }, () => {
const probe = "delete process.env.ATRIS_MACHINE_NAME; process.stdout.write(require('./lib/runs-on').machineName())";
const run = (PATH) => spawnSync(process.execPath, ['-e', probe], { cwd: path.join(__dirname, '..'), env: { HOME: process.env.HOME, PATH }, encoding: 'utf8' }).stdout;
const full = run('/usr/bin:/bin:/usr/sbin:/sbin');
assert.ok(full, 'a name comes back');
assert.equal(run('/usr/bin:/bin'), full);
});
Loading