@@ -93,8 +93,9 @@ void mockProcess(RunProcess mock) {
93
93
runProcess = mock;
94
94
}
95
95
96
- Queue <({String executable, List <String > args})> spyProcess () {
97
- final result = Queue <({String executable, List <String > args})>();
96
+ Queue <({String executable, List <String > args, bool runInShell})> spyProcess () {
97
+ final result =
98
+ Queue <({String executable, List <String > args, bool runInShell})>();
98
99
99
100
final previousRunProcess = runProcess;
100
101
addTearDown (() => runProcess = previousRunProcess);
@@ -108,7 +109,8 @@ Queue<({String executable, List<String> args})> spyProcess() {
108
109
stdoutEncoding,
109
110
workingDirectory,
110
111
}) {
111
- result.add ((executable: executable, args: arguments));
112
+ result
113
+ .add ((executable: executable, args: arguments, runInShell: runInShell));
112
114
113
115
return previousRunProcess (
114
116
executable,
@@ -813,12 +815,12 @@ environment:
813
815
814
816
dev_dependencies:
815
817
plugin1:
816
- path: "${workingDir .dir ('plugin1' ).path }"
818
+ path: "${p . posix . prettyUri ( workingDir .dir ('plugin1' ).path ) }"
817
819
''' );
818
820
expect (tempDir.pubspecOverrides.readAsStringSync (), '''
819
821
dependency_overrides:
820
822
plugin1:
821
- path: "${workingDir .dir ('plugin1' ).path }"
823
+ path: "${p . posix . prettyUri ( workingDir .dir ('plugin1' ).path ) }"
822
824
''' );
823
825
});
824
826
@@ -1110,6 +1112,37 @@ dependency_overrides:
1110
1112
);
1111
1113
expect (processes, isEmpty);
1112
1114
});
1115
+
1116
+ test ('only spawns a shell when running in Windows' , () async {
1117
+ final workingDir = await createSimpleWorkspace ([
1118
+ 'custom_lint_builder' ,
1119
+ Pubspec (
1120
+ 'plugin1' ,
1121
+ environment: {'sdk' : VersionConstraint .parse ('^3.0.0' )},
1122
+ dependencies: {'custom_lint_builder' : HostedDependency ()},
1123
+ ),
1124
+ Pubspec (
1125
+ 'a' ,
1126
+ environment: {'sdk' : VersionConstraint .parse ('^3.0.0' )},
1127
+ devDependencies: {'plugin1' : PathDependency ('../plugin1' )},
1128
+ ),
1129
+ ]);
1130
+
1131
+ final workspace = await fromContextRootsFromPaths (
1132
+ ['a' ],
1133
+ workingDirectory: workingDir,
1134
+ );
1135
+
1136
+ final processes = spyProcess ();
1137
+
1138
+ platformIsWindows = true ;
1139
+ await workspace.runPubGet (workingDir.dir ('a' ));
1140
+ expect (processes.last.runInShell, true );
1141
+
1142
+ platformIsWindows = false ;
1143
+ await workspace.runPubGet (workingDir.dir ('a' ));
1144
+ expect (processes.last.runInShell, false );
1145
+ });
1113
1146
});
1114
1147
1115
1148
group ('isUsingFlutter' , () {
@@ -1718,7 +1751,7 @@ publish_to: 'none'
1718
1751
1719
1752
dev_dependencies:
1720
1753
plugin1:
1721
- path: "${workingDir .dir ('plugin1' ).path }"
1754
+ path: "${p . posix . prettyUri ( workingDir .dir ('plugin1' ).path ) }"
1722
1755
''' );
1723
1756
});
1724
1757
0 commit comments