runSecureEnvCli function
- List<
String> arguments, { - String executableName = 'playx_core:secure_env',
- Map<
String, String> ? environment, - String? workingDirectory,
- StringSink? stdoutSink,
- StringSink? stderrSink,
Runs the secure_env command line tool and returns its exit code.
executableName is how the tool is invoked, shown in its help and in
generated files: playx_core:secure_env (default) or playx:secure_env
when wrapped by the playx package.
environment, workingDirectory, stdoutSink and stderrSink default to
the current process and exist for testing.
Implementation
Future<int> runSecureEnvCli(
List<String> arguments, {
String executableName = 'playx_core:secure_env',
Map<String, String>? environment,
String? workingDirectory,
StringSink? stdoutSink,
StringSink? stderrSink,
}) async {
final cli = _SecureEnvCli(
executableName: executableName,
environment: environment ?? Platform.environment,
workingDirectory: workingDirectory ?? Directory.current.path,
out: stdoutSink ?? stdout,
err: stderrSink ?? stderr,
);
try {
return await cli.run(arguments);
} on _CliException catch (e) {
cli.err.writeln('Error: ${e.message}');
return e.exitCode;
}
}