Skip to content

runAppleScript timeout errors report undefined milliseconds #77

Description

@TyceHerrman

runAppleScript timeout errors report undefined milliseconds

Summary

runAppleScript(script, { timeout }) appears to enforce the timeout correctly, but timeout error messages can report:

Command timed out after undefined milliseconds: osascript

instead of the configured timeout value.

Examples in extension reports

This shows up across several raycast/extensions issues/PRs:

Likely cause

In src/run-applescript.ts, timeout is extracted from either optionsOrArgs or options and passed to getSpawnedPromise, so the process timeout is real:

const { humanReadableOutput, language, timeout, ...execOptions } = Array.isArray(optionsOrArgs)
  ? options || {}
  : optionsOrArgs || {};

const spawnedPromise = getSpawnedPromise(spawned, { timeout: timeout ?? 10000 });

But defaultParsing receives options, which is undefined for the common object-style call:

runAppleScript(script, { timeout: 5000 })

Then src/exec-utils.ts formats the timeout message from options?.timeout, producing undefined milliseconds.

Expected

Timeout errors should include the effective timeout value, for example:

Command timed out after 5000 milliseconds: osascript

Actual

Timeout errors can show:

Command timed out after undefined milliseconds: osascript

Possible fix

Pass the effective timeout through to defaultParsing, for example by passing an options object that includes timeout: timeout ?? 10000.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Severity

    None yet

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions