mirror of
https://github.com/89luca89/distrobox.git
synced 2026-11-02 20:30:16 -06:00
fix(enter): build --dry-run command without a live container
Signed-off-by: Luca Di Maio <luca.dimaio1@gmail.com>
This commit is contained in:
2 files changed
+20
-4
No files matched your search
@@ -522,6 +522,7 @@ func (d *Docker) Enter(
|
||||
options.NoWorkDir,
|
||||
options.CleanPath,
|
||||
options.Verbose,
|
||||
options.DryRun,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("err: %w", err)
|
||||
@@ -726,6 +727,7 @@ func (d *Docker) generateEnterCommand(
|
||||
noWorkDir bool,
|
||||
cleanPath bool,
|
||||
verbose bool,
|
||||
dryRun bool,
|
||||
) ([]string, *containermanager.InspectResult, error) {
|
||||
cmd := []string{}
|
||||
|
||||
@@ -739,8 +741,14 @@ func (d *Docker) generateEnterCommand(
|
||||
|
||||
containerConfig, err := d.InspectContainer(ctx, containerName)
|
||||
if err != nil {
|
||||
// TODO handle missing container
|
||||
return nil, nil, err
|
||||
if !dryRun {
|
||||
return nil, nil, err
|
||||
}
|
||||
// Dry-run without a live container: build the command from host state,
|
||||
// matching the shell (distrobox-enter:578-588).
|
||||
containerConfig = &containermanager.InspectResult{
|
||||
ContainerHome: userenv.LoadUserEnvironment(ctx).Home,
|
||||
}
|
||||
}
|
||||
// User selection
|
||||
if containerConfig.UnshareGroups {
|
||||
|
||||
@@ -531,6 +531,7 @@ func (p *Podman) Enter(
|
||||
options.NoWorkDir,
|
||||
options.CleanPath,
|
||||
options.Verbose,
|
||||
options.DryRun,
|
||||
)
|
||||
if err != nil {
|
||||
return fmt.Errorf("err: %w", err)
|
||||
@@ -809,6 +810,7 @@ func (p *Podman) generateEnterCommand(
|
||||
noWorkDir bool,
|
||||
cleanPath bool,
|
||||
verbose bool,
|
||||
dryRun bool,
|
||||
) ([]string, *containermanager.InspectResult, error) {
|
||||
cmd := []string{}
|
||||
|
||||
@@ -822,8 +824,14 @@ func (p *Podman) generateEnterCommand(
|
||||
|
||||
containerConfig, err := p.InspectContainer(ctx, containerName)
|
||||
if err != nil {
|
||||
// TODO handle missing container
|
||||
return nil, nil, err
|
||||
if !dryRun {
|
||||
return nil, nil, err
|
||||
}
|
||||
// Dry-run without a live container: build the command from host state,
|
||||
// matching the shell (distrobox-enter:578-588).
|
||||
containerConfig = &containermanager.InspectResult{
|
||||
ContainerHome: userenv.LoadUserEnvironment(ctx).Home,
|
||||
}
|
||||
}
|
||||
// User selection
|
||||
if containerConfig.UnshareGroups {
|
||||
|
||||
Reference in new issue
Block a user