Devel::ExecRunnerGenerator

A tool to generate native wrapper executables (similar to the infamous .bat/.sh wrappers)

NAME

Devel::ExecRunnerGenerator

SYNOPSIS


use Devel::ExecRunnerGenerator;
Devel::ExecRunnerGenerator::generate(
    program => "<abs>bin/raku",
    cwd => "<abs>.",
    args => [
        "<abs>./path/to/some/script.raku",
        "<cmd-args>"
    ],
    arg0 => "some-fake-name",
    env-add => {
        DEBUG => 1,
    },
    env-remove => [
        "LD_PRELOAD",
    ],
    archs => [
        "posix",
        "windows-x86_64.exe",
    ],
    out-path => ".",
    :overwrite
);

DESCRIPTION

A tool to generate native wrapper executables (similar to the infamous .bat/.sh wrappers)

Paths

Paths are always to be written with forward slashes as separators.

Argument operators

The program and args parameters must have one of the below operators applied to them. Operators are applied by simply prefixing them to the string.

<plain>
Use the arg unchanged
<cmd-args>
Insert the passed arguments. Must not be followed by anything.
<plat-sep>
Change path (with slashes) to have the platform separators.
<abs>
Turn into an absolute path. The base to prefix is the directory the wrapper executable is located in. Separators are normalized to the platform path separators.
<abs-slash>
Turn into an absolute path. The base to prefix is the directory the wrapper executable is located in. Separators are normalized to be a slash.

Arguments

program

Program to call. Either a program name to be searched in PATH, or a path. The following argument operators are supported:

  • <plain>

  • <plat-sep>

  • <abs>

  • <abs-slash>

Do note that the PATH of the environment after modification by the env-add and env-remove have been done. So clearing out the PATH variable and then trying to call a program via PATH won't work.

arg0

Use a custom arg0 instead of the program name. This is only supported on Windows, as it's not possible to set arg0 in an exec call using a POSIX shell. All platforms except for Windows generate POSIX shell code.

cwd

The working directory to switch to before calling the program. If empty or missing, the working directory will be left unchanged. Either pass an absolute path and use the plain operator or pass a path relative to the wrappers parent directory and use the abs operator. To set the working directory to the wrappers parent directory itself pass "<abs>.".

The following argument operators are supported:

  • <plain>

  • <abs>

args

The arguments to pass to the program. The following argument operators are supported:

  • <cmd-args>

  • <plain>

  • <plat-sep>

  • <abs>

  • <abs-slash>

env-add

Hash of environment variables to add / overwrite in the programs environment.

env-remove

List of environment variables to remove from the programs env.

Standalone usage

A script called `exec-runner-generator` is also provided, which provides access to the above described functionality without having to write any code. The program requires a single argument, a path to a configuration file containing JSON text of the above arguments. An example configuration file is provided at `doc/example.json`.

AUTHOR

Patrick Böker <[email protected]>

COPYRIGHT AND LICENSE

Copyright 2020-2022 Patrick Böker

This library is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

Devel::ExecRunnerGenerator v0.0.1

A tool to generate native wrapper executables (similar to the infamous .bat/.sh wrappers)

Authors

  • Patrick Böker

License

Artistic-2.0

Dependencies

JSON::Fast:ver<0.16>

Test Dependencies

Provides

  • Devel::ExecRunnerGenerator

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.