Skip to content

Fish sourcing uses exit instead of return #16

Description

@hpfr

Hi, thanks for your work on this project!

One potential issue I noticed: Fish complains about areturn from non-function in a translated file containing environment variables that was intended to be sourced by Bash. In Bash return is used for returning from functions and from files being sourced, but in Fish, exit is used. We can't change from return to exit in the sourced Bash file because it exits the shell that's sourcing, unlike fish.

Since source statements are translated by inserting calls to babelfish, maybe a -source option could be introduced indicating the Bash input should have top-level returns converted to exits? Then source statements could be translated by inserting calls to babelfish -source?

What do you think? Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions