Allow it to compile on unsupported platforms
Some checks failed
golangci-lint / lint (push) Successful in 1m16s
test / test (1.23.x, 0.12.0) (push) Failing after 4s
test / test (1.23.x, 0.13.0) (push) Failing after 3s
test / test (1.23.x, 0.13.1) (push) Failing after 4s
test / test (1.23.x, 0.14.0) (push) Failing after 3s

This commit is contained in:
David Vogel 2025-11-03 21:44:01 +01:00
parent bd9c1beac7
commit bc69f35948
3 changed files with 30 additions and 0 deletions

6
cli.go
View File

@ -30,6 +30,9 @@ func (c CLI) VersionString() (string, error) {
if c.ExecutablePath != "" { if c.ExecutablePath != "" {
execPath = c.ExecutablePath execPath = c.ExecutablePath
} }
if execPath == "" {
return "", fmt.Errorf("go-typst doesn't support this platform")
}
cmd := exec.Command(execPath, "--version") cmd := exec.Command(execPath, "--version")
cmd.Dir = c.WorkingDirectory // This doesn't do anything, but we will do it anyways for consistency. cmd.Dir = c.WorkingDirectory // This doesn't do anything, but we will do it anyways for consistency.
@ -64,6 +67,9 @@ func (c CLI) Compile(input io.Reader, output io.Writer, options *CLIOptions) err
if c.ExecutablePath != "" { if c.ExecutablePath != "" {
execPath = c.ExecutablePath execPath = c.ExecutablePath
} }
if execPath == "" {
return fmt.Errorf("go-typst doesn't support this platform")
}
cmd := exec.Command(execPath, args...) cmd := exec.Command(execPath, args...)
cmd.Dir = c.WorkingDirectory cmd.Dir = c.WorkingDirectory

12
cli_js.go Normal file
View File

@ -0,0 +1,12 @@
// Copyright (c) 2025 David Vogel
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
//go:build js
package typst
// The path to the Typst executable.
// We leave that empty as we don't support this platform for now.
var ExecutablePath = ""

12
cli_wasi.go Normal file
View File

@ -0,0 +1,12 @@
// Copyright (c) 2025 David Vogel
//
// This software is released under the MIT License.
// https://opensource.org/licenses/MIT
//go:build wasip1
package typst
// The path to the Typst executable.
// We leave that empty as we don't support this platform for now.
var ExecutablePath = ""