Skip to content

Postinstall on Windows #468

@oprypin

Description

@oprypin

Shards usually specify postinstall: make. But on Windows that line means that make.exe must exist. Usually it is not globally available, of course, and even when it is, it's some quirky alternative implementation of make.

What I've been doing is adding a make.cmd file to my Windows-supporting libs and telling people to run that directly. Unfortunately, even though running just "make" in a CMD shell would invoke that make.cmd file, StartProcess (the current underlying implementation of system() in Crystal) doesn't do that (unconditionally expects .exe extension), so anyone installing a shard that needs postinstall: make on POSIX will always get an error on Windows.

It's not even possible to skip the postinstall step, or stop shards from deleting the lib files altogether on such a failure.

Anyway... Even though I've been arguing that system() should not pick any shell on Windows, specifically for Shards postinstall it would probably be useful to wrap the supplied command into cmd /c. Maybe I'm saying this just because it happens to make my make.cmd hack work. But in any case, I think this is strictly an upgrade from the current state.

Let me know if there are any concerns, or I'll send a PR doing that. Or, well, any other ideas are welcome. Seems hard without allowing OS-specific command lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    To investigate

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions