[flutter_tools] [dap] Add support for passing env variables to spawned processes (#107415)
* [flutter_tools] [dap] Add support for passing env variables to spawned processes * Use named args * Use in-memory fs and FakePlatform * Pass filesystem style to MemoryFileSystem
This commit is contained in:
@@ -305,7 +305,11 @@ class FlutterDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments
|
||||
...?userArgs,
|
||||
];
|
||||
|
||||
await launchAsProcess(executable, processArgs);
|
||||
await launchAsProcess(
|
||||
executable: executable,
|
||||
processArgs: processArgs,
|
||||
env: args.env,
|
||||
);
|
||||
|
||||
// Delay responding until the app is launched and (optionally) the debugger
|
||||
// is connected.
|
||||
@@ -316,12 +320,17 @@ class FlutterDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArguments
|
||||
}
|
||||
|
||||
@visibleForOverriding
|
||||
Future<void> launchAsProcess(String executable, List<String> processArgs) async {
|
||||
Future<void> launchAsProcess({
|
||||
required String executable,
|
||||
required List<String> processArgs,
|
||||
required Map<String, String>? env,
|
||||
}) async {
|
||||
logger?.call('Spawning $executable with $processArgs in ${args.cwd}');
|
||||
final Process process = await Process.start(
|
||||
executable,
|
||||
processArgs,
|
||||
workingDirectory: args.cwd,
|
||||
environment: env,
|
||||
);
|
||||
_process = process;
|
||||
pidsToTerminate.add(process.pid);
|
||||
|
||||
@@ -20,6 +20,7 @@ class FlutterAttachRequestArguments
|
||||
super.restart,
|
||||
super.name,
|
||||
super.cwd,
|
||||
super.env,
|
||||
super.additionalProjectPaths,
|
||||
super.debugSdkLibraries,
|
||||
super.debugExternalPackageLibraries,
|
||||
@@ -91,6 +92,7 @@ class FlutterLaunchRequestArguments
|
||||
super.restart,
|
||||
super.name,
|
||||
super.cwd,
|
||||
super.env,
|
||||
super.additionalProjectPaths,
|
||||
super.debugSdkLibraries,
|
||||
super.debugExternalPackageLibraries,
|
||||
|
||||
@@ -135,7 +135,11 @@ class FlutterTestDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArgum
|
||||
...?args.args,
|
||||
];
|
||||
|
||||
await launchAsProcess(executable, processArgs);
|
||||
await launchAsProcess(
|
||||
executable: executable,
|
||||
processArgs: processArgs,
|
||||
env: args.env,
|
||||
);
|
||||
|
||||
// Delay responding until the debugger is connected.
|
||||
if (debug) {
|
||||
@@ -144,12 +148,17 @@ class FlutterTestDebugAdapter extends DartDebugAdapter<FlutterLaunchRequestArgum
|
||||
}
|
||||
|
||||
@visibleForOverriding
|
||||
Future<void> launchAsProcess(String executable, List<String> processArgs) async {
|
||||
Future<void> launchAsProcess({
|
||||
required String executable,
|
||||
required List<String> processArgs,
|
||||
required Map<String, String>? env,
|
||||
}) async {
|
||||
logger?.call('Spawning $executable with $processArgs in ${args.cwd}');
|
||||
final Process process = await Process.start(
|
||||
executable,
|
||||
processArgs,
|
||||
workingDirectory: args.cwd,
|
||||
environment: env,
|
||||
);
|
||||
_process = process;
|
||||
pidsToTerminate.add(process.pid);
|
||||
|
||||
Reference in New Issue
Block a user