15 lines
439 B
Plaintext
15 lines
439 B
Plaintext
/** 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 sec = parseFloat(argv[1] || '0')
|
|
if (Number.isNaN(sec) || sec < 0) {
|
|
ctx.console.error('sleep: invalid time interval')
|
|
ctx.exitCode = 1
|
|
return
|
|
}
|
|
await new Promise((r) => setTimeout(r, sec * 1000))
|
|
}
|