Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions cmd/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package cmd
import (
"fmt"
"slices"
"os/exec"

"github.com/spf13/cobra"
"github.com/vanilla-os/apx/v2/core"
Expand Down Expand Up @@ -357,9 +358,15 @@ func handleExport(subSystem *core.SubSystem, command, appName, bin, binOutput st

cmdr.Info.Printfln(apx.Trans("runtimeCommand.info.exportedApp"), appName)
} else {
err := subSystem.ExportBin(bin, binOutput)
if err != nil {
return fmt.Errorf(apx.Trans("runtimeCommand.error.exportingBin"), err)
_, binErr := exec.LookPath(bin)
_, outErr := exec.LookPath(binOutput)
if binErr != nil && outErr != nil {
err := subSystem.ExportBin(bin, binOutput)
if err != nil {
return fmt.Errorf(apx.Trans("runtimeCommand.error.exportingBin"), err)
}
} else {
return fmt.Errorf(apx.Trans("runtimeCommand.error.protectedBin"))
}

cmdr.Info.Printfln(apx.Trans("runtimeCommand.info.exportedBin"), bin)
Expand Down
1 change: 1 addition & 0 deletions locales/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ runtimeCommand:
unexportingBin: "An error occurred while unexporting the binary: %s"
startingContainer: "An error occurred while starting the container: %s"
stoppingContainer: "An error occurred while stopping the container: %s"
protectedBin: "Binary already exists on the host."
info:
unexportedApps: "Unexported %d applications"
exportedApps: "Exported %d applications"
Expand Down