Open JUSTIVE opened 5 months ago
can you provide an easier to reproduce code snippet? as-is, this code won't run
sorry for the incomplete information. I found the exact same graphql endpoint which generates the same status what I've got.
endpoint = https://graphql.anilist.co/graphql
(npx get-graphql-schema {endpoint} | grep -v "@connection" > ./src/schema.graphql
perfectly works on my native shell(zsh), with exit code 0.npx get-graphql-schema {endpoint} > ./meh.txt
. without writing to file works perfectly fine. but when I try to get output text from the command like $`npx get-grahpql-schema {endpoint}`.text()
, also shows the same behavior as described on the topic. const {stdout} = $`npx get-grahpql-schema {endpoint}`; Bun.write('./schema.graphql', stdout.toString())
worked without an issue, but const {stdout} = $`npx get-grahpql-schema {private endpoint}.quiet()`; Bun.write('./schema.graphql', stdout.toString())
in order to suppress printed stdout from terminal, also doesn't work as said on the topic.the issue also can be reproduced on 1.1.1.
I've encountered a variation of this with the .quiet()
modifier, where this code never prints 'DEBUG'
due to an immediate exit:
try {
await Bun.$`cd ${path} && bun link`.quiet();
console.log('DEBUG')
} catch (e) {
console.log('DEBUG')
}
Get the same bad behaviour if I use the --silent
flag as in Bun.$`cd ${path} && bun link --silent`
. Works fine if neither the .quiet()
modifier or --silent
flag are present. Switched back to using promisified exec
as it's more reliable.
I too am hitting this bug. This works fine:
const { stdout, stderr, exitCode } = await $`git ls-files ${dirPath}`.nothrow();
But if I add the .quiet()
the process exits:
dlog('getExistingGitFiles: dirPath:', dirPath);
const { stdout, stderr, exitCode } = await $`git ls-files ${dirPath}`.nothrow().quiet();
dlog({exitCode, stderr});
I see the first log message but not the second.
This issue can also be reproduced on v1.1.10
I'm getting the same issue on 1.1.12
.
I'm attempting to simply list some directories and it just exits silently without any additional information. Any code following the shell command does not get excuted.
await $`ls`.text();
console.log('hello world'); // <- never arrive here
Also getting this (1.1.15), only happens if shell call is inside a function:
import { $ } from "bun";
const main = async () =>
try {
console.log("Deleting");
await $`rm -f db.sqlite`;
console.log("After");
} catch (error) {
console.error(error);
}
};
main();
This works:
import { $ } from "bun";
console.log("Deleting");
await $`rm -f db.sqlite`;
console.log("After");
I'm getting the same error on 1.1.17. After running
export async function downloadDumps(lang: LanguageCode, date: string) {
(previous code ...)
await $`bzip2 -dc ${archivePath} >${filePath}`;
}
console.log(`Finished downloading and extracting ${lang} dump`);
return filePath;
}
it exits silently without continuing.
Having a similar problem with 1.1.22
With .quiet()
the shell exits without response if inside an async function
Is it the expected behaviour @Jarred-Sumner ? Thanks
index.ts - WORKS
import { $ } from "bun";
const output = await $`grep -rl "function" .`.quiet();
console.log(output);
index.ts - DOES NOT WORK
import { $ } from "bun";
(async () => {
const output = await $`grep -rl "function" .`.quiet();
console.log(output);
})();
@0xroko @mattvgm the issue you're running into is https://github.com/oven-sh/bun/issues/13713 and is being tracked there
What version of Bun is running?
1.1.0
What platform is your computer?
Darwin 23.0.0 arm64 arm
What steps can reproduce the bug?
run following code with dependencies
What is the expected behavior?
graphql introspection should be done if endpoint is valid graphql endpoint, print 'a' to console output, then relay compile should run.
What do you see instead?
graphql introspection works fine, but the process exit right after it. not even 'a' printed out.
Additional information
the process's exit code is 0