rerun method
Future<int>
rerun(
- List<
String> args, { - required Version installedVersion,
- required CommandLogger logger,
override
Reruns the current command with args in a new process.
Returns the exit code of the new process. Throws a ProcessException if the new process could not be started.
Implementation
@override
Future<int> rerun(
final List<String> args, {
required final Version installedVersion,
required final CommandLogger logger,
}) async {
final invocation = rerunInvocation(
args,
installation: installation,
invokedExecutable: Platform.executable,
resolvedExecutable: Platform.resolvedExecutable,
scriptPath: Platform.script.toFilePath(),
);
logger.debug(
'Rerunning the command: '
'${invocation.executable} ${invocation.args.join(' ')}',
);
await logger.disposeInlineTerminal();
await logger.flush();
final process = await Process.start(
invocation.executable,
invocation.args,
mode: ProcessStartMode.inheritStdio,
environment: {
cliUpdateAttemptedEnvName: installedVersion.canonicalizedVersion,
},
);
return await process.exitCode;
}