cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • See how to use the JMP Marketplace – Free tools to expand JMP capabilities. Register. July 10, 2 pm US Eastern Time.

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