cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • JMP Pro extension simulates Bayesian Optimization runs. Prediction formulas stand in for experimental results. Run simulations and compare results. Download and use the extension.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
shuey
Level II

print to stdout from executable on MacOS

I 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. 

1 ACCEPTED SOLUTION

Accepted Solutions
shuey
Level II

Re: print to stdout from executable

I 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");

View solution in original post

2 REPLIES 2
jthi
Super User

Re: print to stdout from executable

JSL write to stdout and in general Craige has some posts somewhat related to this

-Jarmo
shuey
Level II

Re: print to stdout from executable

I 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");

Recommended Articles