child_process.exec命令返回0时发生错误

时间:2019-08-08 07:07:50

标签: node.js lint-staged

child_process.exec在命令返回0时发生错误

exec(
    `git diff --cached -- ${filenames.join(
        ' ',
    )} | grep -e "^+[^+]" | grep "} from 'react';" -c`,
    (error, errorCnt) => {
        if (error) {
            console.log('React dot error', error);
            throw error;
        }
   }
);

git diff --cached -- ${filenames.join(' ')} | grep -e "^+[^+]" | grep "} from 'react';" -c

我不知道为什么该命令返回0 child_process.exec时会出错。

0 个答案:

没有答案