We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d0e313c commit 735566cCopy full SHA for 735566c
src/command/post/create.ts
@@ -1,4 +1,4 @@
1
-import { mkdir, readFile, writeFile } from 'fs/promises'
+import { mkdir, readFile } from 'fs/promises'
2
import path from 'path'
3
import { spawnSync } from 'child_process'
4
import { createCommand } from 'commander'
@@ -38,10 +38,12 @@ export const createPost = async ({ content, topic }: CreateOptions) => {
38
draftDir,
39
`${format(new Date(), 'yyyy-MM-dd-HH-mm-ss')}.txt`
40
)
41
- await writeFile(draftFile, '', 'utf-8')
42
spawnSync('vim', [draftFile], { stdio: 'inherit' })
43
44
- content = await readFile(draftFile, 'utf-8')
+ content = await readFile(draftFile, 'utf-8').catch((err) => {
+ logger.warning(err)
45
+ return ''
46
+ })
47
}
48
49
content = content?.trim()
0 commit comments