mirror of https://github.com/01-edu/public.git
crash on file notfound instead of comparing strings
This commit is contained in:
parent
141aa6d9d1
commit
b5254e973b
|
@ -20,9 +20,8 @@ export const setup = async ({ path }) => {
|
|||
)
|
||||
const newFileName =
|
||||
newFile || (keyword === 'encode' ? 'cypher.txt' : 'clear.txt')
|
||||
const fileContent = await readFile(newFileName, 'utf8').catch((err) =>
|
||||
err.code === 'ENOENT' ? 'output file not found' : err,
|
||||
)
|
||||
const fileContent = await readFile(newFileName, 'utf8')
|
||||
|
||||
return { data: fileContent }
|
||||
}
|
||||
|
||||
|
|
|
@ -22,9 +22,8 @@ export const setup = async ({ path }) => {
|
|||
const run = async cmd => {
|
||||
const cmdPath = isAbsolute(cmd) ? cmd : join(dir, cmd)
|
||||
const { stdout } = await exec(`node ${path} ${cmdPath}`)
|
||||
const fileContent = await readFile(`vip.txt`, 'utf8').catch(err =>
|
||||
err.code === 'ENOENT' ? 'output file not found' : err,
|
||||
)
|
||||
const fileContent = await readFile(`vip.txt`, 'utf8')
|
||||
|
||||
return { data: fileContent }
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue