721c919c7b
Changes: - kernel 6.0.2 - Broken init scripts - Switch to bun for better peroformance an easier ffi - Removed grup - Efi support without graphics (at least graphics werent tested) - Suppression de toutes les dépendance non libc - new splash - broken audio - typescript support - ls rewritten to be more reliable
40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
//@ts-check
|
|
import { spawnSync, spawn } from 'bun'
|
|
|
|
/**
|
|
* @param {string} path
|
|
*/
|
|
export async function fHook(path) {
|
|
return await spawnAndWait([ '/usr/bin/bun', 'run', path ])
|
|
}
|
|
|
|
/**
|
|
* @param { [string, ...string[]] } cmd
|
|
* @param { import('bun').SpawnOptions.OptionsObject } [option]
|
|
*/
|
|
export async function spawnAndWait(cmd, option) {
|
|
console.log('spawning ' + cmd.join(' '))
|
|
return spawnSync(cmd, {
|
|
...option,
|
|
env: {
|
|
PATH: "/bin:/sbin:/usr/bin:/usr/sbin",
|
|
...process.env,
|
|
...(option?.env || {})
|
|
},
|
|
|
|
stdout: "inherit",
|
|
stdin: "inherit",
|
|
stderr: "inherit"
|
|
})
|
|
}
|
|
|
|
/**
|
|
* @param { string } path
|
|
* @param { string[] } [args]
|
|
* @param { import('bun').SpawnOptions.OptionsObject } [options]
|
|
*/
|
|
export async function startjs(path, args = [], options = {}) {
|
|
const SpawnArguments = args.map(arg => {return arg.includes(' ') ? `"${arg}"` : arg})
|
|
return spawnAndWait(['/usr/bin/bun', path, ...SpawnArguments ], options)
|
|
}
|