Open
Description
Hi,
i need to run code in nodejs. So my idea was to spawn a nodejs process and communicate with it by sending jsonl messages to stdin (you call it sdtin) & getting jsonl messages back from stdout.
But when i attempt to write to stdin it just crashes sketch. No crash reports in console.
const child = spawn(
path.resolve(process.cwd(), "./Contents/Sketch/external"),
[],
{cwd: path.resolve(process.cwd(), "./Contents/Sketch")},
);
// @ts-ignore
const stdin: Writable = child.stdin || child.sdtin;
const buf = Buffer.from(JSON.stringify({type: "getImages"}) + "\n");
console.log("buf", buf);
await new Promise<void>((onOk, onErr) => {
// crashes here
stdin.write(buf, (err) => {
if (err !== null && err !== undefined) {
onErr(err);
} else {
onOk();
}
});
});
Metadata
Assignees
Labels
No labels