Skip to content

Commit

Permalink
mecabをWindowsでは動かさないように
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Sep 17, 2020
1 parent c4c9120 commit 7dfda64
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/misc/mecab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ async function me(text: string): Promise<string[][]> {
return s.result;
}

// mecab-async on Windows には OSコマンドインジェクションがある
if (process.platform === 'win32') {
return [];
}

const mecab = new MeCab();
mecab.command = config.mecabSearch?.mecabDic ? `${config.mecabSearch.mecabBin} -d ${config.mecabSearch.mecabDic}` : config.mecabSearch?.mecabBin;
return await promisify(mecab.parse).bind(mecab)(text);
Expand Down

0 comments on commit 7dfda64

Please sign in to comment.