User bio
404 bio not found
Member since Aug 31, 2017
Replies:

I had to modify it a little and now its freezing because of the $$$AssertEquals. How can i make it work with the asserts?

 

ClassMethod WriteCapture(vstrCommand As %String, Output strOutput As %String, Output status As %Status) [ ProcedureBlock = 0 ]
{
    set tOldIORedirected = ##class(%Device).ReDirectIO()
    set tOldMnemonic = ##class(%Device).GetMnemonicRoutine()
    set tOldIO = $io
    try {
        set strOutput=""

        //Redirect IO to the current routine - makes use of the labels defined below
        use $io::("^"_$ZNAME)

        //Enable redirection
        do ##class(%Device).ReDirectIO(1)

        XECUTE (vstrCommand, .status)
        
    catch ex {
        set strOutput = ""
    }

    //Return to original redirection/mnemonic routine settings
    if (tOldMnemonic '= "") {
        use tOldIO::("^"_tOldMnemonic)
    else {
        use tOldIO
    }
    do ##class(%Device).ReDirectIO(tOldIORedirected)

    //Labels that allow for IO redirection
    //Read Character - we don't care about reading
rchr(c) quit
    //Read a string - we don't care about reading
rstr(sz,to) quit
    //Write a character - call the output label
wchr(s) do output($char(s)) quit
    //Write a form feed - call the output label
wff() do output($char(12)) quit
    //Write a newline - call the output label
wnl() do output($char(13,10)) quit
    //Write a string - call the output label
wstr(s) do output(s) quit
    //Write a tab - call the output label
wtab(s) do output($char(9)) quit
    //Output label - this is where you would handle what you actually want to do.
    // in our case, we want to write to str
output(s) set strOutput=strOutput_s   quit
}

Certifications & Credly badges:
Mihai has no Certifications & Credly badges yet.
Global Masters badges:
Mihai has no Global Masters badges yet.
Followers:
Mihai has no followers yet.
Following:
Mihai has not followed anybody yet.