Amélioration de l'ergonomie de l'interface et de la table de relecture
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 3m11s
All checks were successful
Deploy to Production / Build and Deploy (push) Successful in 3m11s
This commit is contained in:
26
.agent/skills/impeccable/scripts/lib/open-system-browser.mjs
Normal file
26
.agent/skills/impeccable/scripts/lib/open-system-browser.mjs
Normal file
@@ -0,0 +1,26 @@
|
||||
import { spawn } from 'node:child_process';
|
||||
|
||||
export function browserOpenCommand(url, {
|
||||
platform = process.platform,
|
||||
comspec = process.env.ComSpec || process.env.COMSPEC || 'cmd.exe',
|
||||
} = {}) {
|
||||
if (platform === 'darwin') return { command: 'open', args: [url] };
|
||||
if (platform === 'win32') return { command: comspec, args: ['/c', 'start', '', url] };
|
||||
return { command: 'xdg-open', args: [url] };
|
||||
}
|
||||
|
||||
export function openSystemBrowser(url, {
|
||||
platform = process.platform,
|
||||
comspec = process.env.ComSpec || process.env.COMSPEC || 'cmd.exe',
|
||||
spawnImpl = spawn,
|
||||
} = {}) {
|
||||
const { command, args } = browserOpenCommand(url, { platform, comspec });
|
||||
try {
|
||||
const child = spawnImpl(command, args, { stdio: 'ignore', detached: true });
|
||||
child.on('error', () => {});
|
||||
child.unref();
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user