update hash files test
This commit is contained in:
@@ -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)
|
||||
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user