This repository was archived by the owner on Jan 6, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Expand file tree Collapse file tree 2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -133,6 +133,21 @@ it(`should propagate kill signals`, () => {
133
133
expect ( crossSpawnMock . __mock . spawned . kill ) . toHaveBeenCalledWith ( 'SIGBREAK' )
134
134
} )
135
135
136
+ it ( `should keep backslashes` , ( ) => {
137
+ isWindowsMock . __mock . returnValue = true
138
+ crossEnv ( [ 'echo' , '\\\\\\\\someshare\\\\somefolder' ] )
139
+ expect ( crossSpawnMock . spawn ) . toHaveBeenCalledWith (
140
+ 'echo' ,
141
+ [ '\\\\someshare\\somefolder' ] ,
142
+ {
143
+ stdio : 'inherit' ,
144
+ env : Object . assign ( { } , process . env ) ,
145
+ } ,
146
+ )
147
+ isWindowsMock . __mock . reset ( )
148
+ } )
149
+
150
+
136
151
function testEnvSetting ( expected , ...envSettings ) {
137
152
if ( expected . APPDATA === 2 ) {
138
153
// kill the APPDATA to test both is undefined
Original file line number Diff line number Diff line change @@ -58,9 +58,10 @@ function parseCommand(args) {
58
58
// match "\'" or "'"
59
59
// or match "\" if followed by [$"\] (lookahead)
60
60
. map ( a => {
61
- const re = / ( \\ ) ? ' | ( [ \\ ] ) (? = [ $ " \\ ] ) / g
61
+ const re = / \\ \\ | ( \\ ) ? ' | ( [ \\ ] ) (? = [ $ " \\ ] ) / g
62
62
// Eliminate all matches except for "\'" => "'"
63
63
return a . replace ( re , m => {
64
+ if ( m === "\\\\" ) return "\\"
64
65
if ( m === "\\'" ) return "'"
65
66
return ''
66
67
} )
You can’t perform that action at this time.
0 commit comments