summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Juraj Kapsz <dev@jurajkapsz.sk> 2024-12-10 13:43:44 +0100
committerGravatar GitHub <noreply@github.com> 2024-12-10 12:43:44 +0000
commit316959355c3d59723ecb3e0f417becf1f03ddd74 (patch)
treeb120ffd9bd0ef9dcf5841f7f59d8e5477b9a022e
parent0d1eab560d56c51c359bbd35e8bfb51e238611ee (diff)
downloadastro-316959355c3d59723ecb3e0f417becf1f03ddd74.tar.gz
astro-316959355c3d59723ecb3e0f417becf1f03ddd74.tar.zst
astro-316959355c3d59723ecb3e0f417becf1f03ddd74.zip
fix: xclip process runtime (#12658)
xclip process made `spawnSync` not [to return](https://nodejs.org/api/child_process.html#child_processspawnsynccommand-args-options:~:text=with%20the%20exception%20that%20the%20function%20will%20not%20return%20until%20the%20child%20process%20has%20fully%20closed). Further info at [Stack Overflow](https://stackoverflow.com/questions/52169670/node-child-process-execsync-hangs-with-xclip). Also updated the xclip arguments as per man pages for better familiarity, although the used arguments worked.
-rw-r--r--.changeset/shy-worms-talk.md5
-rw-r--r--packages/astro/src/cli/info/index.ts4
2 files changed, 7 insertions, 2 deletions
diff --git a/.changeset/shy-worms-talk.md b/.changeset/shy-worms-talk.md
new file mode 100644
index 000000000..c22501e2d
--- /dev/null
+++ b/.changeset/shy-worms-talk.md
@@ -0,0 +1,5 @@
+---
+'astro': patch
+---
+
+Fixes astro info copy to clipboard process not returning to prompt in certain cases.
diff --git a/packages/astro/src/cli/info/index.ts b/packages/astro/src/cli/info/index.ts
index 348d2fae3..aca66ad71 100644
--- a/packages/astro/src/cli/info/index.ts
+++ b/packages/astro/src/cli/info/index.ts
@@ -66,7 +66,7 @@ export async function copyToClipboard(text: string, force?: boolean) {
// Unix: check if a supported command is installed
const unixCommands: Array<[string, Array<string>]> = [
- ['xclip', ['-sel', 'clipboard', '-l', '1']],
+ ['xclip', ['-selection', 'clipboard', '-l', '1']],
['wl-copy', []],
];
for (const [unixCommand, unixArgs] of unixCommands) {
@@ -101,7 +101,7 @@ export async function copyToClipboard(text: string, force?: boolean) {
}
try {
- const result = spawnSync(command, args, { input: text });
+ const result = spawnSync(command, args, { input: text, stdio: ['pipe', 'ignore', 'ignore'] });
if (result.error) {
throw result.error;
}