Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node:child_process execSync does not throw #20343

Closed
gaoxiaoliangz opened this issue Sep 1, 2023 · 2 comments
Closed

node:child_process execSync does not throw #20343

gaoxiaoliangz opened this issue Sep 1, 2023 · 2 comments
Labels
bug Something isn't working correctly node compat

Comments

@gaoxiaoliangz
Copy link

a.js

import { execSync } from "node:child_process";

try {
  execSync("cd some-random-place");
} catch (error) {
  console.log("oops");
}

node version: v18.14.1
node a.js

/bin/sh: line 0: cd: some-random-place: No such file or directory
oops

deno vesion: 1.36.3
deno run -A a.js

/bin/sh: line 0: cd: some-random-place: No such file or directory

node throws while deno doesn't, aren't they expected to behave the same?

@bartlomieju
Copy link
Member

Yes, they are expected to behave the same. It looks like an actual bug.

@bartlomieju bartlomieju added bug Something isn't working correctly node compat labels Sep 1, 2023
@satyarohith
Copy link
Member

Not sure when it was fixed but latest version of deno now matches the behaviour of node:

➜ bat -p t.mjs
import { execSync } from "node:child_process";

try {
  execSync("cd some-random-place");
} catch (error) {
  console.log("oops");
}

➜ deno --version
deno 1.41.0 (release, aarch64-apple-darwin)
v8 12.1.285.27
typescript 5.3.3

➜ deno run -A t.mjs
/bin/sh: line 0: cd: some-random-place: No such file or directory
oops
➜ node t.mjs
/bin/sh: line 0: cd: some-random-place: No such file or directory
oops

Closing this issue as resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat
Projects
None yet
Development

No branches or pull requests

3 participants