print to stdout from executable on MacOSI was wondering if there is a way to print to stdout on MacOS when running a jsl executable. the print command prints to the log, which is lost once the executable finishes.
Automation and ScriptingRe: print to stdout from executableJSL write to stdout and in general Craige has some posts somewhat related to this
Re: print to stdout from executableI believe I have found a solution below. however I was wondering if this workaround is the easiest.
stdout_print = Function({msg},
{_tty},
Run Program(
Executable("/bin/sh"),
Options({"-c", "ps -o tty= -p $(ps -o ppid= -p $(ps -o ppid= -p $$)) | tr -d ' ' > /tmp/jmp_tty.txt"})
);
Wait(1);
_tty = "/dev/" || Trim(Load Text File("/tmp/jmp_tty.txt"));
Run Program(
Executable("/bin/sh"),
Options({"-c", "echo '" || msg || "' > " || _tty})
);
);
stdout_print("hello");