Skip to content
This repository was archived by the owner on Jun 11, 2024. It is now read-only.

Commit ee6cf46

Browse files
Use regex for carriage return in windows
In windows env, the ImageMagick version string is containing `\r\n` at the end of each line, split and replace methods are keeping this `\r` leading to an issue with `semver.valid()` returning `false` because extracted `imVersion` is something like `"6.9.3-2\r"`. Closes gh-12
1 parent 69d5123 commit ee6cf46

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/themeroller-image.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,7 @@ async.series( [
348348
if ( !( /ImageMagick/ ).test( output ) ) {
349349
return callback( new Error( "ImageMagick not installed.\n" + output ) );
350350
}
351-
imVersion = output.split( "\n" )[ 0 ].replace( /^Version: ImageMagick ([^ ]*).*/, "$1" );
351+
imVersion = output.split( /\r?\n/ )[ 0 ].replace( /^Version: ImageMagick ([^ ]*).*/, "$1" );
352352
if ( !semver.valid( imVersion ) ) {
353353
return callback( new Error( "Could not identify ImageMagick version.\n" + output ) );
354354
}

0 commit comments

Comments
 (0)