exec method
Runs command once and returns its captured output (used for git). cwd
defaults to rootPath.
Implementation
@override
Future<WsExecResult> exec(String command, {String? cwd}) async {
final shell = Platform.isWindows
? (Platform.environment['ComSpec'] ?? 'cmd.exe')
: (Platform.environment['SHELL'] ?? '/bin/sh');
final args = Platform.isWindows ? ['/c', command] : ['-c', command];
final r = await Process.run(shell, args, workingDirectory: cwd ?? rootPath);
return WsExecResult(
exitCode: r.exitCode,
stdout: '${r.stdout}',
stderr: '${r.stderr}',
);
}