Skip to content

Commit 35faa2a

Browse files
test: avoid shell-splitting when calling git; use execFileSync to pass filename as arg (fix Windows/WSL test)
1 parent 7ebaf98 commit 35faa2a

File tree

1 file changed

+3
-1
lines changed
  • lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-license-header-year/lib

1 file changed

+3
-1
lines changed

lib/node_modules/@stdlib/_tools/eslint/rules/jsdoc-license-header-year/lib/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
// MODULES //
2222

2323
var execSync = require( 'child_process' ).execSync;
24+
var execFileSync = require( 'child_process' ).execFileSync;
2425
var replace = require( '@stdlib/string/replace' );
2526

2627

@@ -99,7 +100,8 @@ function main( context ) {
99100

100101
// Use `git` to determine the year the file was created...
101102
try {
102-
expected = execSync( 'git log --diff-filter=A --follow --format=%ad --date=short -- '+filename, {
103+
// Use execFileSync with argument array to avoid shell word-splitting for paths
104+
expected = execFileSync( 'git', [ 'log', '--diff-filter=A', '--follow', '--format=%ad', '--date=short', '--', filename ], {
103105
'encoding': 'utf8'
104106
});
105107
expected = expected.split( '-' )[ 0 ];

0 commit comments

Comments
 (0)