update hash files test

This commit is contained in:
Salman Muin Kayser Chishti
2025-11-18 14:21:47 +00:00
parent 7cba4c8084
commit a3588a70ba
5 changed files with 64 additions and 63 deletions
@@ -0,0 +1,39 @@
const childProcess = require('child_process')
const path = require('path')
function parseArgs() {
const result = {}
for (const arg of process.argv.slice(2)) {
const equalsIndex = arg.indexOf('=')
if (equalsIndex === -1) {
continue
}
const key = arg.slice(0, equalsIndex)
const value = arg.slice(equalsIndex + 1)
result[key] = value
}
return result
}
const args = parseArgs()
const filePath = args.file
if (!filePath) {
throw new Error('file is not specified')
}
const waitScript = path.join(__dirname, 'wait-for-file.js')
const waitArgs = [waitScript, `file=${filePath}`]
const waitProcess = childProcess.spawn(process.execPath, waitArgs, {
stdio: 'inherit',
detached: false
})
waitProcess.unref()
if (args.stderr === 'true') {
process.stderr.write('hi')
}
const exitCode = args.exitCode ? parseInt(args.exitCode, 10) : 0
process.exit(exitCode)
@@ -1,8 +1,8 @@
//first half of © character
process.stdout.write(Buffer.from([0xC2]), (err) => {
process.stdout.write(Buffer.from([0xC2]), () => {
//write in the callback so that the second byte is sent separately
setTimeout(() => {
process.stdout.write(Buffer.from([0xA9])) //second half of © character
}, 5000)
}, 100)
})