function sc_withOutputToPort(p, thunk) {
    try {
    var tmp = SC_DEFAULT_OUT; // THREAD: shared var.
    SC_DEFAULT_OUT = p;
    return thunk();