Skip to content

[Bug]: Confusing error when cwd directory doesn't exist #1386

@Exidex

Description

@Exidex

What happened?

If the current working directory that is passed to the command doesn't exist, the error is very confusing and difficult to debug

How it should work?

The error should be related to missing directory

How to reproduce the bug?

Given following file:

#!/usr/bin/env -S deno run -A

import "npm:zx@8.8.5/globals";

$.verbose = true;

await $({ cwd: '/path/that/doesnt/exist' })`cat test`

Execute the script

chmod +x ./test.ts && ./test.ts

Version

8.8.5

What's OS kind?

Mac

What JS runtime is used?

Deno

Runtime Version

deno 2.6.5 (stable, release, aarch64-apple-darwin), v8 14.2.231.17-rusty, typescript 5.9.2

Error stack / relevant log output

user@pc scripts % chmod +x ./test.ts && ./test.ts
$ cat test
error: Top-level await promise never resolved
await $({ cwd: '/path/that/doesnt/exist' })`cat test`
^
    at <anonymous> (file:///Users/user/scripts/test.ts:7:1)

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions