updates
This commit is contained in:
@@ -1,4 +1,20 @@
|
||||
// Drive path: /bin/echo — print arguments (kernel invokes run(argv))
|
||||
async function run(ctx, argv) {
|
||||
ctx.console.log(argv.slice(1).join(' '))
|
||||
/** Shared helpers for drive-resident /bin scripts (prepended before each command). */
|
||||
function bareStdin(ctx) {
|
||||
return typeof ctx.shellStdin === 'string' ? ctx.shellStdin : ''
|
||||
}
|
||||
|
||||
async function run(ctx, argv) {
|
||||
const parts = argv.slice(1)
|
||||
let n = false
|
||||
if (parts[0] === '-n') {
|
||||
n = true
|
||||
parts.shift()
|
||||
}
|
||||
const s = parts.join(' ')
|
||||
const w = globalThis.process?.stdout?.write
|
||||
if (typeof w === 'function') {
|
||||
w.call(globalThis.process.stdout, s + (n ? '' : '\n'))
|
||||
} else {
|
||||
ctx.console.log(n ? s : s)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user