Skip to content

Commit

Permalink
Await execution of a process in a subshell and log if it errors (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
axel-op committed Mar 5, 2024
1 parent af44a70 commit 37efc9a
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions app/bin/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,18 @@ dynamic main(List<String> args) async {
final canonicalPathToPackage = inputs.paths.canonicalPathToPackage;
final userProcessResult = await gaction.exec('whoami', [], silent: true);
final user = (userProcessResult.stdout as String).trim();
logger.debug('whoami returned: $user');
gaction.exec('chown', [user, '-R', canonicalPathToPackage]);
logger.info('whoami returned: $user');
final chownProcessResult = await gaction.exec(
'chown',
[user, '-R', canonicalPathToPackage],
);
if (chownProcessResult.exitCode > 0) {
logger.warning(
"Couldn't change ownership of $canonicalPathToPackage: ${jsonEncode({
"stdout": chownProcessResult.stdout,
"stderr": chownProcessResult.stderr,
})}");
}

await analysis.start();

Expand Down

0 comments on commit 37efc9a

Please sign in to comment.