Skip to content

osproc: hardcoded error message relating to the binary not being a command #1557

@Luyten-Orion

Description

@Luyten-Orion

osproc always seems to output an error message relating to the binary being executed rather than an actual reason.

Example

import std/osproc

discard execCmdEx("echo", workingDir = "not-a-dir")

Actual Output

/home/chronos/test/main.nim(3) main
/home/chronos/.nimskull/lib/pure/osproc.nim(1637) execCmdEx
/home/chronos/.nimskull/lib/pure/osproc.nim(1045) startProcess
/home/chronos/.nimskull/lib/pure/osproc.nim(1155) startProcessAuxFork
/home/chronos/.nimskull/lib/pure/includes/oserr.nim(95) raiseOSError
Error: unhandled exception: Additional info: Could not find command: '/bin/sh'. OS error: No such file or directory [OSError]

Expected Output

Something about the directory not existing and that being the cause of the execution not happening.

Possible Solution

Most likely, just some sanity checks like if the working directory exists.

Additional Information

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingstdlibStandard library

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions