You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
✨ [command] Add a way to run commands as a different user without changing the command definition (#333)
<!--
Copyright (C) 2020-2022 Arm Limited or its affiliates and Contributors.
All rights reserved.
SPDX-License-Identifier: Apache-2.0
-->
### Description
this is mostly for `posix` platforms where some commands need to be run
as `sudo` or as a different user.
### Test Coverage
<!--
Please put an `x` in the correct box e.g. `[x]` to indicate the testing
coverage of this change.
-->
- [x] This change is covered by existing or additional automated tests.
- [ ] Manual testing has been performed (and evidence provided) as
automated testing was not feasible.
- [ ] Additional tests are not required for this change (e.g.
documentation update).
// NewCommandAsRoot will create a command translator which will run command with `sudo`
53
+
funcNewCommandAsRoot() *CommandAsDifferentUser {
54
+
returnNewCommandAsDifferentUser("sudo")
55
+
}
56
+
57
+
// Sudo will call commands with `sudo`. Similar to NewCommandAsRoot
58
+
funcSudo() *CommandAsDifferentUser {
59
+
returnNewCommandAsRoot()
60
+
}
61
+
62
+
// NewCommandInContainerAs will redefine commands to be run in containers as `username`. It will expect [gosu](https://github.com/tianon/gosu) to be installed and the user to have been defined.
0 commit comments