Skip to content

Commit b191795

Browse files
committed
fix(commitizen): fix bug when trying to read stdout
On my system `stdout` was undeifned and resulted in "Cannot read property 'trim' of undefined". Switching this code to also use execa fixes that issue.
1 parent a0752b4 commit b191795

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/commitizen/adapter.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from 'fs';
33
import findNodeModules from 'find-node-modules';
44
import _ from 'lodash';
55
import detectIndent from 'detect-indent';
6-
import sh from 'shelljs';
6+
import execa from 'execa';
77

88
import {isFunction} from '../common/util';
99

@@ -150,5 +150,5 @@ function resolveAdapterPath (inboundAdapterPath) {
150150
}
151151

152152
function getGitRootPath () {
153-
return sh.exec('git rev-parse --show-toplevel').stdout.trim();
153+
return execa.sync('git', ['rev-parse', '--show-toplevel']).stdout.trim();
154154
}

0 commit comments

Comments
 (0)