run method
Runs this command.
The return value is wrapped in a Future
if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
Future<void> run() async {
final bashScript = await script();
final scriptFile = tempExecutableScriptFile(bashScript);
final Progress progress =
Progress(print, stderr: printerr, captureStderr: true);
try {
dcli.startFromArgs(
scriptFile.absolute.path,
argResults!.arguments,
workingDirectory: workingDirectory?.absolute.path,
progress: progress,
terminal: withStdIn,
);
} catch (e, stack) {
throw BashCommandException(
script: bashScript,
commandName: name,
arguments: argResults!.arguments,
exitCode: progress.exitCode!,
cause: e,
stack: stack,
);
} finally {
scriptFile.deleteSync(recursive: true);
}
}