8 Commits

Author SHA1 Message Date
Alfonso Sánchez-Beato
bad061e63f osutil: add RunCmd and RunSplitOutput functions
These functions return separately std{err,out}, and will be used to
replace calls to exec.CombinedOuput.
2023-10-05 14:14:28 +02:00
Michael Vogt
f0dd2d524e osutil,cmdutil: move CommandFromCore and make it use the snapd snap (if available)
The CommandFromCore helper is currently always looking at the
core snap. With the snapd snap we need to refactor it so that
it uses the snapd snap if available and just falls back to the
core snap.

The osutil.CommandFromCore is not in the rightplace and it also does
not take the snapd snap into account. This PR moves it to the
cmd/cmdutil package (cannot be in cmd because of an import cycle
with cmd/snapinfo.go).

It also tweaks the arguments slightly (no need to pass the
snapMountDir anymore).
2019-04-30 16:07:35 +02:00
Maciej Borzecki
9caacd035d osutil: do not import dirs
Importing `dirs` package in `osutil` leads to import cycles if one attempts to
use `osutils` from packages that are directly or indirectly imported by `dirs`,
such as `release`. It doesn't make any sense for `osutil` to depend on
other non `*util` packages.

Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
2018-12-11 07:27:28 +01:00
Zygmunt Krynicki
7474da4cb8 osutil: adjust StreamCommand tests for golang 1.9
In golang 1.9 there are richer error constructs returned from certain
operations and tests were very precisely monitoring the result. This
patch adjust tests to work on both golang 1.9 and earlier.

Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
2017-09-08 11:39:21 +02:00
John R. Lenton
e0b8200f67 osutil: introducing WaitingReader 2017-07-03 15:38:48 +01:00
John R. Lenton
d35701d3a0 osutil: RunAndWait, for DRY between hookstate and oddjobstate. 2017-06-20 12:04:50 +01:00
Simon Fels
33209629c4 errtracker,osutil: replace paths to /bin/{true,false} with find results 2017-03-31 10:28:32 +02:00
Michael Vogt
0e53b0aac9 store: use xdelta3 from core if available and not on the regular system (#2791)
This avoids us having to add a dependency to snapd for xdelta3 (and fixes the issues that snapd 2.0.10 from Ubuntu 16.04.1 won't apt-get upgrade with any new dependencies).

It is slightly complicated because we want to ensure that the correct ld-linux.so is used and also that the correct libraries from core (instead of from the host) are used.
2017-02-15 10:52:09 -02:00