Skip to content

Commit f697f12

Browse files
authored
Merge pull request #63 from getsolus/issue_54
Redirect child processes' stderr to the parent stdout
2 parents 28346b9 + eb57cba commit f697f12

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

builder/chroot.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ import (
2424
"github.com/getsolus/libosdev/commands"
2525
)
2626

27+
func init() {
28+
commands.SetStderr(os.Stdout)
29+
}
30+
2731
// Chroot will attempt to spawn a chroot in the overlayfs system.
2832
func (p *Package) Chroot(notif PidNotifier, pman *EopkgManager, overlay *Overlay) error {
2933
slog.Debug("Beginning chroot", "profile", overlay.Back.Name, "version", p.Version,

builder/util.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ func ChrootExec(notif PidNotifier, dir, command string) error {
192192
args := []string{dir, "/bin/sh", "-c", command}
193193
c := exec.Command("chroot", args...)
194194
c.Stdout = os.Stdout
195-
c.Stderr = os.Stderr
195+
c.Stderr = os.Stdout
196196
c.Stdin = nil
197197
c.Env = ChrootEnvironment
198198
c.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
@@ -212,7 +212,7 @@ func ChrootExecStdin(notif PidNotifier, dir, command string) error {
212212
args := []string{dir, "/bin/sh", "-c", command}
213213
c := exec.Command("chroot", args...)
214214
c.Stdout = os.Stdout
215-
c.Stderr = os.Stderr
215+
c.Stderr = os.Stdout
216216
c.Stdin = os.Stdin
217217
c.Env = ChrootEnvironment
218218

cli/init.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
)
3434

3535
func init() {
36+
commands.SetStderr(os.Stdout)
3637
cmd.Register(&Init)
3738
cmd.Register(&cmd.Help)
3839
}

0 commit comments

Comments
 (0)