Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions notfair-cmo/src/server/fs/pick-folder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export type PickFolderResult =
export async function pickFolder(opts: {
prompt?: string;
defaultLocation?: string;
signal?: AbortSignal;
}): Promise<PickFolderResult> {
const p = platform();
if (p === "darwin") {
Expand All @@ -42,6 +43,7 @@ export async function pickFolder(opts: {
async function pickFolderMac(opts: {
prompt?: string;
defaultLocation?: string;
signal?: AbortSignal;
}): Promise<PickFolderResult> {
// Build the AppleScript expression carefully: we control both args, so
// there's no untrusted shell-injection vector, but we still escape any
Expand Down Expand Up @@ -73,7 +75,7 @@ async function pickFolderMac(opts: {
execFile(
"/usr/bin/osascript",
["-e", script],
{ timeout: DIALOG_TIMEOUT_MS },
{ timeout: DIALOG_TIMEOUT_MS, signal: opts.signal },
(err, stdout, stderr) => {
// With default options (no encoding override), Node returns
// stdout/stderr as strings. err carries .code on timeout /
Expand All @@ -86,8 +88,6 @@ async function pickFolderMac(opts: {
resolve({ stdout, stderr, code: errCode });
},
);
// We don't wire up an AbortSignal here; the DIALOG_TIMEOUT_MS ceiling
// protects against a wedged osascript subprocess.
});

if (result.code !== 0) {
Expand Down